Egypt will have extensive support in the West for its actions against the Islamic State in Libya this week, in response to the killing of Egyptian Christians there.
Its wider policies towards Libya are more controversial, however.
Egypt has been intervening in Libya for months, backing one of the two rival coalitions that claim to represent the country's legitimate government.
As militants in both countries develop closer ties, Egypt has become increasingly concerned about instability in Libya spilling over to its own Sinai peninsula.
Support for Egypt from European countries was underscored this week when Egypt announced it had concluded a deal to buy 24 Rafale fighter jets from France, at an estimated cost of $5.9bn (£4bn). And the US has been keen to emphasise the role of Sunni Arab nations like Egypt in combating jihadists in the region.
Islamists and jihadists
In terms of politics, Egypt's policies towards Libya reflect the attempts by the government of President Abdel Fattah al-Sisi's to undermine political Islamist movements - whether violent or peaceful - across the region.
This follows the ousting of the Muslim Brotherhood's Mohammed Morsi as Egypt's president in 2013, and the failure of Tunisia's Islamist Ennahda party to win parliamentary elections in 2014.
Unlike its Western allies, Egypt's leaders emphasise the view that all forms of political Islam are a threat to international security.
Since overthrowing Mr Morsi, they have banned the Muslim Brotherhood, calling it a terrorist organisation.
By contrast, the US and Europe differentiate between forms of political Islam that they can potentially work with, and more radical violent groups.
Both in Egypt and in Libya, a variety of groups seek to claim legitimacy based on religious values. Rather than representing a single bloc, they are often competing fiercely with each other for the same audience.
The Muslim Brotherhood says it is a non-violent movement that can act as a counterweight to violent forms of political Islam.
It has condemned the IS killing of the Christians in Libya, though many Egyptian Christians feared the Brotherhood too.
Meanwhile, IS has tried to stoke sectarianism in Egypt by linking their killings to the reported murders of Egyptian Christian women who had converted to Islam, even though these reports have proven to be false.
In Egypt, most of those killed around the time of the coup in 2013 died when security forces violently dispersed two sit-ins by Muslim Brotherhood supporters in Cairo.
But there has been a sustained campaign of violence by jihadist groups since then, particularly by those based in the Sinai peninsula.
These groups contend that the coup in Egypt shows peaceful means of achieving Islamic government do not work.
In Libya, the political situation is extremely fragmented. Since the 2011 ousting of Muammar Gaddafi, no government has managed to establish control over the whole country.
Libya's rival power bases
Two military coalitions claim to represent the legitimate government.
One is Libya Dawn, a grouping of militias that includes various Islamist groups as well as forces from the east of the country, which supports the former elected parliament, the General People's Congress.
It vehemently opposes any role for former members of the Gaddafi regime in politics, and is backed by Qatar and Turkey.
The other is Dignity, headed by a general, Khalifa Haftar, which supports the more recently elected (and internationally recognised) parliament, the House of Representatives.
It would prefer to include some members of the previous regime in politics, and is backed by Egypt and the UAE. The leaders of each side have limited control over their supporters, and many areas of the country are in effect autonomous.
Egypt backs the Dignity coalition because of its stance against political Islam.
In August last year there were reports that the Egyptian and UAE armies had co-operated to bomb Libya Dawn militants, and in January, Gen Haftar said his forces were receiving arms and training from Egypt and the UAE.
Some analysts argue this international involvement is making it more difficult for Libyans to resolve the internal conflict, and adding to the proliferation of arms there.
With these latest developments, as with the recent killing of a Jordanian pilot, IS' targeted violence has prompted cross-border military action by Arab armies.
This is a marked contrast with al-Qaeda, which was targeted primarily by international forces or, within specific countries, by the domestic security services.
The enhanced role of Arab air forces may be seen by some as a step towards dealing with security issues on a regional basis.
But ultimately, IS is thriving on the failure of states, in countries where there is an absence of effective or legitimate government.
Tackling the group requires local and international efforts to be better directed towards both ending conflicts and rebuilding the states.