UNITED NATIONS (AP) — Egypt’s relations with the United States are “unsettled” as the country struggles to redefine its national interests vis-à-vis other countries, the foreign minister said.

The U.S. was a close ally of Hosni Mubarak, Egypt’s longtime authoritarian ruler who was ousted in an uprising in early 2011. America counted on him to keep the peace with Israel and as a bulwark against the rise of Islamic fundamentalists in the Mideast.

Relations were less cozy with the Islamist Muslim Brotherhood, which then rose to power through democratic elections. Then the Brotherhood’s Mohammed Morsi was ousted from the presidency on July 3 for failing to form an inclusive government.

Interim Foreign Minister Nabil Fahmy is now part of a government appointed by Egypt’s interim president, who was installed by Egypt’s powerful military after Morsi’s ouster.

“We have had two revolutions in 2-1/2 years. Egyptians are trying to define their own identity,” Fahmy told The Associated Press in an interview Wednesday in New York, where he is attending the U.N.’s annual meeting of world leaders. “We are looking outwards and trying to determine who our friends are. It’s an emotional process.”

Fahmy, a veteran diplomat who served as Cairo’s ambassador to Washington for nine years previously, said the U.S. is also adapting to a new reality created by Arab Spring uprisings that have swept through Tunisia, Egypt, Libya, Yemen, Syria and Bahrain over the past three years.

“The Americans, like most of the world, to be fair to the Americans, have always been used to dealing with governments in the Arab world, not with people, ” Fahmy said.

He praised President Barack Obama’s speech to the U.N. General Assembly on Tuesday, saying his acknowledgement that Morsi did not rule in an inclusive manner was a positive step.

“This is the correct interpretation of what the Egyptian people did,” Fahmy said. “When they came out on the 30th of June, they were not arguing about the efficiency of the government. The issue was they had a revolution two years before because they wanted to be stakeholders and players in establishing Egypt’s future and they felt that they were being excluded.”

Morsi was ousted for failing to live up to promises to form an inclusive government that would represent the spectrum of political views, women and religious minorities. The Brotherhood, which dominated all elections after Mubarak fell, was constantly accused of monopolizing power.

Morsi has been detained since July 3. Fahmy said his release is up to the courts.

“Nobody in the government has that authority” to order his release, Fahmy said. He added that the courts were also responsible for outlawing the Muslim Brotherhood, a ruling that came out earlier in the week.

“The court took the decision and now we are faced with a court decision and we are bound to implement it,” he explained. Fahmy cited the Brotherhood’s appeal, which was filed the day after the ruling as proof that the legal process was working.

He also said he told U.S. Secretary of State John Kerry this week that Egyptians who are not charged with offenses directly related to the military will only be subject to civilian law — something that has been long sought by human rights activists. Egypt was under a state of emergency for decades that subjected them to the whims of a brutal police force.

Anger at the police’s power and brutality was a driving force behind the first uprising.

Egypt, the Arab world’s most populous nation, is watching the conflict in Syria with an eye on its own national security.

“Egypt’s national security is based on our interests, not ideology,” he said, explaining the shift in Cairo’s approach to the Syrian war after Morsi’s ouster.

Morsi’s government was outspoken in calling for Syrian President Bashar Assad to step down. However, Fahmy stopped short of making the same demand. But he made it clear he believes that Assad’s legitimacy has been eroded.

“You need to create a new Syria, both in substance and in form. And I think it will be easier to do so if you have new figures,” he said.

Fahmy said Egypt is open to improving its relations with all nations, even Iran with which it has had no diplomatic relations for more than three decades.

“I can’t imagine how a rational Iranian policy maker or a rational Egyptian policy maker would ignore the other side,” he said, cautioning that there are issues that need to be resolved.

“It’s not going to be flip over the page and we will forget about everything that happened.”