Even as debates rage within Egypt about how best to nurture a fledgling democracy, one issue is settled: Outside its borders, the country is determined to resume its place as an independent power broker, with consequences that the United States might not always like.

Already, the country is reexamining its natural gas contracts with Israel, which some see as a precursor to a broader reckoning over the decades-long truce between the two nations. Egypt’s Foreign Ministry gave the crucial push to Fatah and Hamas leaders in the Palestinian territories to reach the unity agreement announced in Cairo on Wednesday after years of stalemate.

And in the biggest sign yet of burgeoning independence, diplomats are signaling that they will expand ties with Iran — an unimaginable step during the long, U.S.-oriented tenure of former president Hosni Mubarak.

Foreign policy “is going to be more pro-Egypt,” said Nabil Fahmy, dean of the School of Public Affairs at the American University in Cairo and a former ambassador to the United States. “This strengthens Egypt’s position. If we’re not engaging important states in our region, we lose leverage.”

The revolution that swept away Mubarak’s 30-year rule in favor of democracy meant also a newly accountable foreign policy, and most Egyptians are skeptical both of the United States and of the 1978 Camp David accords with Israel, according to a Pew poll released this week.

Egypt’s leaders may simply be revamping their policies to better reflect popular sentiment, knowing that they will soon be held accountable in elections, observers say.

“If we had a democratic system at the time of Sadat,” Fahmy said, referring to Anwar Sadat, the Egyptian president who signed the Camp David accords, “he couldn’t have signed the agreement.”

Fahmy added, however, that he doubted that the fundamentals of Egypt’s agreements would change.

The deal between Fatah and Hamas is an immediate payoff for Egypt’s new foreign policy, analysts said. Former Egyptian intelligence director Omar Suleiman had been trying to broker an agreement for years, but he was always hampered by the perception that Egypt’s sympathies were with Israel, not with the Palestinians. The official Egyptian ban on the Muslim Brotherhood, the parent organization of Hamas, did not help either, the analysts said.

Now, the Muslim Brotherhood can operate openly and is one of the most powerful political organizations in the country. Freed from old suspicions of Egypt’s motivations, Foreign Minister Nabil Elaraby was able to broker the deal in less than two months.

Still, the new openness between Egypt and Iran is a striking departure for two governments that have long disliked each other. Egypt gave asylum to the shah of Iran after the 1979 Iranian revolution, and he is buried in Cairo’s al-Rifai Mosque. A main street in Tehran is named for Khalid Islambouli, one of Sadat’s assassins.

That enmity has been replaced by cautious flirtation. Diplomats and analysts in Cairo have said they do not expect full relations to resume immediately, but they view an eventual exchange of ambassadors as inevitable.

“There’s no question that the foreign minister, both publicly and privately, wanted to sound like Egypt is open to this idea” of resuming relations with Iran, said a Western diplomat in Cairo who spoke on the condition of anonymity to candidly discuss private diplomatic conversations.

For weeks, circumspect overtures have been taking place via the state-owned media of each country. Last week, Iran’s state-run Press TV reported that an ambassador to Egypt had been named, then quickly retracted the story. Elaraby, Egypt’s new foreign minister, has said he wants to reset relations with Iran.

And the Sunni Muslim Brotherhood, which has historically been cautious about Shiite-led Iran, has indicated it is open to a gradual resumption of ties, playing down sectarian divides and emphasizing political interests. “You are not talking about a Shia country and a Sunni country,” said Mohammed Shams, a Brotherhood activist and student organizer. “You are talking about two countries with mutual interests.”

Mona Makram-Ebeid, a founding member of the Egyptian Council for Foreign Affairs and a former lawmaker, said the Mubarak government had maintained an antagonistic stance toward Iran mainly “to toe the line of America,” adding: “This was not in our interest whatsoever.”

Elaraby has a new strategy, Makram-Ebeid said. “The objective is to restore Egypt to its previous place of leadership regionally and in the Arab world,” she said.

Special correspondent Muhammad Mansour contributed to this report.