Mohammed Mursi, Egypt's first elected leader since former head of state Hosni Mubarak was toppled in early 2011, has vowed to be "president for all" after beating his independent rival, ex-premier Ahmed Shafiq, to the presidency.

"I will be a president for all Egyptians," Mursi said just hours after he was declared the winner in a divisive election.

"I call on you, great people of Egypt, to strengthen our national unity," he added. National unity "is the only way out of these difficult times".

He also praised the "martyrs" of the uprising for his victory and said: "The revolution continues."

Hundreds of Egyptians took to the streets after the announcement, with some returning to Tahrir Square to celebrate his victory.

Mursi resigned from the Muslim Brotherhood to become president but analysts warn that Mohammed Badie, the Murshid or Guide of the Brotherhood, might remain an influential force behind the scene.

The brotherhood has been persecuted by the government for decades but remained hugely popular among Egyptians, in part due to it social work at grassroots level.

Mursi's election mark a turning point for Egypt, which may depart from the previous regime's foreign policies.

Egypt and Iran

Governments in the Middle East were quick to congratulate Mursi on his victory.

Ahead of the release of the election results, Iran's Fars news agency quoted him saying he wanted to reinforce ties with Iran, a clear shift form Hosni Mubarak's policy.

A rapprochement with Tehran, he said, would "create a balance of pressure in the region, and this is part of my programme".

Mursi's comments come as Western powers seek to isolate Iran over its nuclear programme. Tensions between the Islamic Republic and Gulf States over a disputed island in the Gulf have also increased.

Iran has also continued in its steadfast support of Syrian president Bashar Al-Assad despite the uprising and is at odds with the Arab League call for regime change in Syria.

Iran's foreign ministry described Mursi's victory as the latest stage of Egypt's "Islamic awakening".

"The foreign ministry of the Islamic Republic of Iran congratulates the victory of the Egyptian nation in these elections and the presidency of Doctor Mohammed Mursi," it said on the Iranian Students' News Agency (ISNA).

"The revolutionary movement of the Egyptian people is in its final stages of the Islamic awakening and [heralds] a new era of change in the Middle East."

Egypt and Israel

Israeli prime minister Benjamin Netanyahu issued a statement saying Israel "respects the results".

"Israel hopes to continue cooperation with the Egyptian government on the basis of the peace treaty," his office.

Israeli media, however, remained more cautious, with many wary of the Islamist's victory.

"Darkness in Egypt," read the headline of Yediot Aharonot newspaper. Commentator Smadar Peri said: "When the presidential palace in Cairo is painted for the first time in Islamic colours this is a black and dark day."

The Maariv daily wrote: "The new Middle East. The fear has become reality, the Muslim Brotherhood are in power in Egypt.

"The peace treaty has been put in doubt," it continued. "There is very serious concern in the political and military class in Israel because Egypt is the largest of its neighbours and has decisive influence on the Arab world."

Yaakov Katz, writing in the English-language Jerusalem Post, said: "Good news [that] in the short term nothing is expected to change.

"Egypt's president-elect will have far greater challenges to deal with than to pick a fight with the Jewish state."

Egypt and Palestine

Hamas, which has its roots in the Muslim Brotherhood, welcomed Mursi's victory with celebratory gunfire in the Gaza Strip which borders Egypt.

Senior Hamas official Mahmoud Zahar told Agence France Presse the victory was "a historic moment and a new era in the history of Egypt".

Zahar said Mursi's victory was "a defeat for the programme of normalisation and security cooperation with the enemy," referring to Israel.

The Palestinian Authority also congratulated Mursi.

"We congratulate Doctor Mohammed Mursi, the Muslim Brotherhood candidate, on his win in the Egyptian presidential elections, and his election as president of Egypt," Palestinian negotiator Saeb Erakat told AFP.

Egypt and the Gulf States

The United Arab Emirates congratulated the new president but called for "stability" in the North African nation, state news agency WAM reported.

"[The UAE] welcomes the results of presidential elections and respects the choice of the brotherly Egyptian people in their track of democracy," said a foreign ministry statement.

"[We] hope all efforts combine now towards securing stability, harmony, and cooperation among all parties to fulfil the aspirations of the Egyptian people," it said.

The Emir of Kuwait, Sheikh Sabah al-Ahmed al-Sabah, congratulated Mursi on the "confidence the brotherly people of Egypt had granted him by electing him as president," the official KUNA news agency reported.

He wished the new leader "good luck in fulfilling the aspirations of Egyptians in achieving further prosperity and for security and stability to prevail", it added.

Bahrain's state news agency said King Hamad congratulated the elected winner and welcomed , "an atmosphere of freedom and democracy".