By targeting the Islamic State group with air strikes in Libya, Egypt's President Abdel Fattah al-Sisi, having crushed Islamist opponents at home, has become a key ally of the West against jihadists, experts say.
His warplanes bombed IS camps and weapons stores in the Libyan city of Derna hours after the Sunni extremists released a gruesome video showing masked jihadists beheading 21 Egyptian Christians on a Libyan beach.
The raids were the first time Egypt has announced military action against Islamist targets in its western neighbour, having previously denied it targeted militants there.
"The air strikes in Libya are an important new factor," said Zack Gold of the Tel Aviv-based Institute for National Security Studies.
"Egypt and President Sisi have emerged as a key ally of the West in the fight against IS."
Egypt had steered clear of a direct fight with IS outside of the country, although US officials say Cairo previously allowed the United Arab Emirates to use its air bases to bomb Islamists in Libya.
Sisi has regularly said Cairo is fighting its own "war on terrorism," in the restive Sinai Peninsula, where an Islamist insurgency has killed scores of policemen and soldiers.
Officials blame the blacklisted Muslim Brotherhood of president Mohamed Morsi, who was ousted by then army chief Sisi in July 2013, for deadly attacks in the country.
These attacks have been claimed by jihadist groups such as IS-linked Ansar Beit al-Maqdis.
The Brotherhood has been a target of a brutal crackdown overseen by Sisi since Morsi's ouster.
More than 1,400 people, mostly Morsi supporters, have been killed, thousands imprisoned and hundreds sentenced to death after speedy trials which the United Nations says are "unprecedented in recent history".
Global rights groups have condemned the crackdown against the Brotherhood, which made strong electoral gains after the 2011 revolution that ousted longtime autocrat Hosni Mubarak.
"The creation of the Islamic State... has helped the Egyptian narrative that this was not just a threat to Iraq and Syria, but this was a threat from violent extremism to the Sinai, to Yemen," said Gold.
"The United States is now more willing to accept Egypt's position that its own transition is going to be a slow one and that its own internal issue is not open to international debate."
Weeks after police raided two pro-Morsi protest camps in Cairo on August 14, 2013 at the cost of hundreds of lives, Washington suspended its annual $1.5 billion military aid to Cairo, citing human rights concerns.
It warmed up to Cairo only in recent months by unfreezing the aid, and it offered Apache helicopters to the Egyptian army to fight militants in Sinai.
Bombing IS targets in Libya will now show Sisi's resolve to counter a wider Islamist threat in the region, said H.A. Hellyer, Arab affairs expert at Washington-based Brookings Institute.
"In this case, he probably sees the Egyptian action as comparable to the Jordanian military retaliation after the killing of their pilot," said Hellyer.
Jordan, a member of US-led coalition fighting IS in Iraq and Syria where the group has captured swathes of territory, escalated its air campaign after the jihadists claimed the murder of a Jordanian pilot captured in Syria in December.
A gruesome video released this month by IS showed jihadists burning pilot Maaz al-Kassasbeh alive in a metal cage.
"With strikes in Libya, Sisi's stature will definitely rise in the West and also at home," where he already enjoys popularity, said Mustapha Kamel al-Sayyid, a Cairo University political professor.
"Although he has been building new allies by speaking to Russia, China and France, the Libyan operation will also help lift the rest of US sanctions imposed on Egypt when the military aid was frozen."
On Monday, Egypt signed a 5.2 billion euro ($5.9 billion) deal to purchase 24 French Rafale warplanes -- a show of support for Sisi who wants to break a US monopoly over Egypt's arms supplies.
Hellyer said air raids in Libya would silence some critics of Sisi's government.
"There remain those critical of Egypt due to human rights concerns and curbing of civil liberties, but against the backdrop of Daesh or ISIS, that's likely to take a back seat," he said referring to IS with its other names.