Egypt has no plans to provide the United States with direct military assistance in its war against Islamic State in Iraq and Syria even though American aerial bombardment may not be enough to defeat the group, the country's prime minister said.
But Ibrahim Mehleb left open the possibility of military action if Cairo's Gulf Arab allies are threatened by the al Qaeda offshoot.
With one of the biggest armies in the Middle East and wide experience in battling militancy, Egypt is regarded as a vital ally for the United States, which provides billions of dollars in annual aid to Cairo.
Mehleb said Egypt's priority is ensuring stability at home, where security officials face resilient jihadist insurgents based in the Sinai Peninsula and regard militants in neighboring Libya as a serious threat.
"For the Egyptian army the most important thing is its borders and the stability of its country and the protection of its country," Prime Minister Ibrahim Mehleb told Reuters in an interview.
He spoke hours after a bomb killed six Egyptian soldiers in the Sinai.
The peninsula is the epicenter of an insurgency that has killed hundreds of Egyptian security forces since the army toppled President Mohamed Morsi of the Muslim Brotherhood last year after mass protests against his rule.
But Mehleb appeared more flexible on the issue of Egyptian intervention when it comes to the security of oil-producing Gulf Arab allies Saudi Arabia and the United Arab Emirates.
Those countries have pumped billions of dollars in aid and petroleum products into Egypt since then army chief Abdel Fattah al-Sisi ousted Morsi in July 2013 and then mounted one of the toughest crackdowns on Islamists.
They regard the Brotherhood as an existential threat to their monarchies and have formed an axis with Egypt against countries like Qatar, which backs the group.
Mehleb stressed that Egypt never wants to interfere in the affairs of other states. But he went on to say:
"The security of the Gulf is the security of Egypt and Egypt's security is the Gulf's security."
Asked if the most populous Arab country would be willing to step in if Saudi Arabia and United Arab Emirates tell Cairo that Islamic State has emerged as a threat to their security, Mehleb said: "We will cross that bridge when we get there."
The United States is seeking more help in its fights against Islamic State, which has seized parts of Iraq and Syria and has threatened to redraw the map of the Middle East.
US Secretary of State John Kerry Kerry made several visits to Egypt in recent months, hoping it would weigh in.
Asked to assess whether the United States would have to escalate beyond airstrikes to defeat Islamic State in Iraq and Syria, Mehleb was cautious.
He noted that it was vital to improve the performance of Iraq's army, which virtually collapsed when Islamic State swept through northern Iraq in June.
Iraqi army must be strong
"Let's wait. The aerial intervention and the presence of the Iraqi army on the ground without doubt will have an impact, a positive impact in containing terrorism. The situation is difficult," said Mehleb.
"The aerial intervention of the United States is a very important intervention at this stage. But is it enough? With the strengthening of the Iraqi army and the presence of the Iraqi army on the ground. We must evaluate step by step. It is still too early to judge what will happen in the field."
Mehleb was especially concerned by Islamic State fighters with Western passports who can evade detection at airports.
"Today there are people from the Islamic State from Europe. This is the biggest challenge today. When we said terrorism must be fought on a global level, many now understand this message."
Sisi, now Egypt's elected president, has warned that Islamic militants are a global threat. He has been especially worried about militants thriving in the chaos of post-Gaddafi Libya.
Security officials say those Islamists have made contact with Sinai militants belonging to the Ansar Bayt al-Maqdis group. An Ansar commander told Reuters the group has been coached by Islamic State.
Egypt is training anti-Islamist Libyan forces on its soil and sharing intelligence in a bid to stamp out militancy next door.
Security officials say Libyan pilots in Egyptian warplanes recently bombed militant targets in Libya, though officials in Cairo also say non-intervention is the guiding policy.
"We favor non-interference in Libya's internal affairs. But we support both peoples and we also protect our border with Libya which is more than 1,000 kilometers," said Mehleb.
"This gives Egyptian officials and the Egyptian army one goal - protection of the Egyptian border."
Perhaps signs that Islamic State members have themselves infiltrated Egypt are more worrying. Security officials told Reuters 13 members of the group - Egyptians, Iraqis and Syrians - were arrested in Egypt in recent weeks.
"Maybe some infiltrated Egypt but we are protecting our borders and Egypt's laws strongly confront these terrorist movements. Security forces are present," said Mehleb.
"There may be infiltration but that has had no impact on Egypt's security. Egypt's security is stable. Compare this day to a year ago. Egypt is stabilizing and terrorism is receding."
Bombings have eased. But regional violence has complicated life for authorities in Egypt, which has battled Islamists for decades and produced some of the most notorious ones, including al Qaeda leader Ayman al-Zawahri, a former physician.
"The borders of terrorism are the whole world. When we confront terrorism in our country we must follow what happens in the entire region," said Mehleb.
"We follow what happens in Libya, what happens in Syria, what happens in Yemen, what happens in Iraq."
Mehleb placed the Muslim Brotherhood in the same category as Ansar and other groups which have carried out bombings against security personnel and Egyptian officials, an allegation it strongly denies.
Egyptian security forces killed about 1,000 Brotherhood supporters and arrested thousands of others after Morsi's fall, drawing condemnation from human rights groups and severely straining Cairo's ties with Turkey and Qatar, which back the group.
Asked if Cairo perceived those countries as a security threat, Mehleb said: "Anyone who works against Egypt will lose."