CAIRO (AP) — Islamist Mohammed Morsi promised a “new Egypt” and unwavering support to the powerful military as he took the oath of office Saturday to become the country’s first freely elected president, succeeding Hosni Mubarak who was ousted 16 months ago.

In a solemn inauguration ceremony before the Supreme Constitutional Court, Morsi also became the Arab world’s first freely elected Islamist president and Egypt’s fifth head of state since the overthrow of the monarchy some 60 years ago.

“We aspire to a better tomorrow, a new Egypt and a second republic,” Morsi said before the black-robed judges in the court’s Nile-side headquarters built to resemble an ancient Egyptian temple.

“Today, the Egyptian people laid the foundation of a new life — absolute freedom, a genuine democracy and stability,” said Morsi, a 60-year-old U.S.-trained engineer from the Muslim Brotherhood, a fundamentalist group that has spent most of the 84 years since its inception as an outlawed organization harshly targeted by successive governments.

He later delivered his inauguration address at a gigantic Cairo University lecture hall packed with several thousands, including many members of the Islamist-dominated parliament dissolved by the military earlier in June.

Morsi repeated his oath of office and lavishly praised the military, which has rushed a series of decrees this month that stripped Morsi of significant powers, gave it legislative power and took control of the process of drafting a permanent constitution. It has also retained its influence on key domestic and foreign policy issues.

“The armed forces are the shield and sword of the nation,” he said. “I pledge before God that I will safeguard that institution, soldiers and commanders, raise its prestige and support it with all the powers available to me so it can be stronger.”

But Morsi also appeared later in the address to urge the military to hand over all powers to his elected administration.

“The (ruling) Supreme Council of the Armed Forces has honored its promise not to be a substitute for the popular will and the elected institutions will now return to carry out their duties as the glorious Egyptian army returns to being devoted to its mission of defending the nation’s borders and security,” he said.

Military ruler Field Marshal Hussein Tantawi was in attendance along with other generals from the ruling council. His arrival at the hall was greeted by chants of “the army and the people are one hand.” He and Gen. Sami Anan, the powerful chief of staff, wore a blank face throughout Morsi’s address, occasionally offering support to Morsi with a polite clap of their hands.

Later at a military ceremony held at a base east of Cairo, Tantawi and Anan saluted Morsi as he arrived and awarded him the “shield of the Armed Forces” — the Egyptian military’s highest honor. Morsi also received a 21-gun salute before he and Tantawi addressed the ceremony.

Morsi used his Cairo University address to send an implicit message of reassurance to Israel, while also pledging support for the “legitimate rights” of the Palestinians.

He said his administration would continue to honor its international treaties — a thinly veiled reference to the 1979 Egyptian-Israeli peace treaty.

Relations between the two neighbors have become particularly tense since last year’s overthrow of Mubarak, who had forged close ties with the Jewish state during his 29-year rule. The rise to power of Egyptian Islamists has been a source of alarm among many Israelis.

Hundreds of soldiers and policemen guarded the Supreme Constitutional Court building as Morsi arrived shortly after 11 a.m. local time (0900 GMT) in a small motorcade to take the oath of office. Only several hundred supporters gathered outside the court to cheer the new president and, in a departure from the presidential pomp of the Mubarak era, traffic was only briefly halted to allow Morsi’s motorcade through on the usually busy road linking the city center with its southern suburbs.

In another sign of the change of style, Morsi began his address at Cairo University with an apology to students whose final exams had to be postponed to allow the ceremony to be held at the main campus. He was given an official welcome at the university with a military band playing the national anthem as he stood at attention.

Saturday’s swearing-in also marked a personal triumph for Morsi, who was not the Brotherhood’s first choice as president and was only thrown into the race when the group’s original candidate, chief strategist and financier Khairat el-Shater, was disqualified over a Mubarak-era criminal conviction.

Derided as the Brotherhood’s uncharismatic “spare tire,” his personal prestige has surged since his victory, and received another boost Friday after he delivered a speech in Tahrir Square in which he tried to present him as a candidate of not just Islamists but of all those who want to complete the work of the 2011 uprising against the authoritarian Mubarak.

“Egypt today is a civil, national, constitutional and modern state,” Morsi, wearing a blue business suit and a red tie, told the judges in the wood-paneled chamber where he took the oath of office. “It is a strong nation because of its people and the beliefs of its sons and its institutions.”

Morsi took a symbolic oath Friday in Tahrir Square, the birthplace of the uprising that ended Mubarak’s authoritarian rule last year, and vowed to reclaim presidential powers stripped from his office by the military council that took over from the ousted leader.

Morsi’s speech Friday in Tahrir Square was filled with dramatic populist gestures. The 60-year-old president-elect staked a claim to the legacy of the uprising and voiced his determination to win back the powers stripped from his office by the generals.

Addressing a crowd that repeatedly shouted, “We love you Morsi!” he began his speech by joining them in chanting, “Revolutionaries and free, we will continue the journey.” Later he opened his jacket wide to show that he was not wearing a bullet-proof vest.

“Everybody is hearing me now. The government … the military and the police. … No power above this power,” he told the crowd. “I reaffirm to you I will not give up any of the president’s authorities. I can’t afford to do this. I don’t have that right.”

But by agreeing to take the official oath before the court, rather than before parliament as is customary, he bowed to the military’s will in an indication that the contest for power will continue.

The generals dissolved the Islamist-packed legislature after the same Supreme Constitutional Court that swore him in Saturday ruled that a third of its members were elected illegally.

The military has also declared itself the legislative power. It gave itself control over the drafting of a new constitution, sidelining Morsi’s Muslim Brotherhood, which had sought to influence the process by packing the drafting panel with Islamists.

The generals also created a National Security Council to formulate key domestic and foreign policies. Military officers outnumber civilians sitting on the council by about two-to-one, and decisions are made by a simple majority.

Copyright 2012 The Associated Press.