CAIRO - A newcomer to international affairs, Egypt's Islamist president, Mohamed Morsy, has so far shown skill in moving Egypt back towards the center of regional diplomacy and setting out his own foreign policy, without upsetting the Americans or Gulf states.

His trip to Iran, the first by an Egyptian leader since the 1979 Islamic revolution, could have upset ties with Washington and Gulf Arab capitals, yet seems to have reassured them because Morsy criticized Iran's ally Syria robustly when in Tehran.

A military campaign in Sinai to crack down on militants who killed 16 Egyptian border guards on Aug. 5 drew complaints from Israel about the use of heavy armor close to its border.

But that early test of ties passed off fairly smoothly and Morsy, who took office on June 30, reaffirmed Egypt's commitment to the peace treaty with Israel, reassuring the United States which had backed his ousted predecessor Hosni Mubarak.

It is a delicate path he is treading to prove how Egypt has changed under a president who rose to power under the Muslim Brotherhood, a group opposed to Israel and with which Washington only opened formal ties last year.

As he moves to re-establish Egypt at the heart of regional diplomacy, Morsy cannot afford to alienate traditional allies in the West or the wealthy Gulf, whose financial support he needs to steady his nation's ailing economy.

"He is playing a delicate balancing act in that he is giving different things to different sides and it has been quite impressive for someone who isn't tested on the world stage," said Shadi Hamid of the Brookings Doha Center.

"He is turning out to be a strong figure and that is the way he is carrying himself on the regional and international stage," he said of the president, the son of a peasant farmer who secured a scholarship to study in the United States.

Dismissed as the "spare tire" during his election campaign because he was the Brotherhood's second choice candidate, 61-year-old Morsy has quickly consolidated his position at home by clawing back powers from the military, whose generals had tried to limit the president's role before he came to power.

Watched closely

Bold moves at home have been mirrored abroad, notably by his attendance on Aug. 30 at the Non-Aligned Movement (NAM)summit in Tehran. Diplomatic ties with Iran were broken after Egypt's 1979 peace deal with Israel and Cairo and Tehran have not had full ties for three decades.

Morsy's Tehran visit, though only a few hours long and ostensibly to hand over the NAM presidency to Iran, would have been unimaginable under Mubarak and marked a sharp break with the past.

It was watched closely by the West and in the Gulf, both wary of Iran's nuclear ambitions, which Tehran insists are peaceful and not aimed at making a bomb.

Sitting next to Iranian President Mahmoud Ahmadinejad who has rallied behind the Syrian government, Morsy referred to the "oppressive regime" in Syria and said it was an "ethical duty" to support rebels trying to bring it down.

Some Iranian state media, apparently trying to hide the incident, scrubbed out the Syrian reference in translation.

"We were very reassured and impressed with the robust line," said one Western diplomat. "It is a sign of a certain assertiveness and confidence in Egyptian foreign policy which comes from having a democratically elected president."

Gulf diplomats appeared equally comforted. One ambassador in Cairo said his country was not worried by Morsy's trip because he went to hand over the NAM presidency but added: "The most important thing was President Morsy gave a strong speech."

Morsy needs to keep close ties with the Gulf states as a vital source of economic aid. But he has had to build trust in a region where some officials worry that the Brotherhood's influence could stir up opposition against their monarchies.

Highlighting the importance of the relationship to Egypt, Morsy's first foreign trip as president was to Saudi Arabia less than two weeks into office. To date, the kingdom has pledged more than $2 billion to support Egypt's struggling economy.

Another Gulf envoy said: "We feel Egypt under President Morsy is moving with balanced steps with everyone. This will gradually restore the pivotal Egyptian role in the region."

As part of that bid to put Egypt back at the heart of the region, Morsy has proposed Saudi Arabia, Turkey, Iran and Egypt form a quartet to help solve the Syria crisis. While Iran backs Damascus, the others want President Bashar Assad to quit.

Active role

Mustapha Kamel Al-Sayyid, a professor of political science at Cairo University, described the plan as "unrealistic and impractical" because the group could never agree. But he said that may not have been the main point of the initiative.

"It is an indication that Egypt would like to play an active role on the Middle East scene not just the Arab scene," he said.

As well his regional trips, Morsy went to China last month, where the economy was top of the agenda, and will travel to the United States this month. A European trip is also expected.

Spelling out his plans in a Reuters interview last week, Morsy said: "International relations between all states are open and the basis for all relations is balance. We are not against anyone but we are for achieving our interests."

He also sought to reassure Israel - without mentioning it by name - by reaffirming Cairo's commitment to its international treaties. The Brotherhood, which Morsy formally resigned from on taking office, calls Israel a racist and expansionist state.

Indicating that Israel was encouraged by this, Israeli Foreign Minister Avigdor Lieberman said a day after the interview that he was "happy" to hear the comments but also called for "tangible" actions and suggested Morsy visit Israel.

Egypt's peace treaty with the Jewish state was a cornerstone of Mubarak's foreign policy and still brings Egypt $1.3 billion in US military aid each year.

Even Mubarak made only one trip to Israel in his 30 years in office, and that was to attend a funeral, not an official visit for talks. But he kept up regular public contacts, meeting top Israeli officials on their frequent trips to Egypt.

That level of contacts seems unlikely under Morsy. But the border flare-up on Aug. 5 in Sinai suggested Egypt under Morsy and Israel had enough lines of communication to keep peace.

"Both sides continue to show a pragmatic approach," said the Western diplomat. "But what is important is that there continue to be channels of communication between the two sides to prevent any misunderstanding spiralling out of control."