Ben Curtis, Associated Press
Hezbollah-allied Amal Movement supporters ride scooters near Martyr's Square in Beirut on Sunday as they celebrate the election of a new Lebanese president.

BEIRUT, Lebanon — Lebanon's parliament elected a new president Sunday, taking a step to stabilize the country after a long, violent political crisis and ushering in a shift in the balance of power in favor of Iranian-backed Hezbollah.

The election of army chief Michel Suleiman brought palpable relief to ordinary Lebanese who feared in recent weeks that their country was in danger of another civil war.

Celebratory gunfire reverberated across the capital of Beirut as the election results were announced in the early evening. Glittering fireworks lit the night sky over downtown a couple of hours later as cars formed motorcades and honked their horns.

"He will be the savior. He is the hope for the future," Amer Eido, 29, said of Suleiman as he watched the fireworks. "All the people are placing hopes on him and, God willing, he will bring prosperity."

One motorcade was adorned with fluttering Qatari flags and pictures of the emir of Qatar, who brokered the deal last week that ended an 18-month political deadlock between the Hezbollah-led opposition and the Western-backed government. Red-and-white Lebanese flags and pictures of the new president were everywhere.

"I call on you all, people and politicians, for a new beginning," Suleiman said after he was sworn in. "Let us be united.

"The people have given us their confidence to fulfill their aspirations, not to afflict them with our petty political disputes," he added.

Political bickering prevented parliament from electing a president 19 times, leaving the country without a president since Emile Lahoud left office in November.

Suleiman's election is the first tangible step in the deal to end the political crisis that erupted this month into the worst violence since Lebanon's 1975-90 civil war.

The Arab-mediated deal reached in Doha, Qatar, was a major victory for Hezbollah and its allies, who got their long-standing demand for veto power over all government decisions.

The Shiite militant group won that concession after it demonstrated its military power earlier this month. Gunmen overran large parts of Muslim west Beirut after the government tried to rein Hezbollah in.

The show of force gave Hezbollah new political leverage and it is now reaping the spoils of clashes that left 67 dead.

With the president's election, Prime Minister Fuad Saniora's Cabinet automatically dissolved, though Suleiman asked him to stay on as caretaker until a new prime minister and government is named.

The outgoing government and the opposition have agreed to form a new unity government. The majority will choose the prime minister but will have to seek consensus with Hezbollah on key decisions and appointments.

Hezbollah's ascendancy is a setback for the U.S., which had strongly backed the Lebanese government for three years and is concerned that Iran's influence is spreading in the Middle East. Nevertheless, the U.S. welcomed the developments in Lebanon and its diplomats and visiting Congressmen attended Suleiman's election.

"I am hopeful that the Doha Agreement, which paved the way for this election, will usher in an era of political reconciliation to the benefit of all Lebanese," President Bush said in a statement.

Suleiman, who as president has limited influence over government policy, faces a difficult challenge in unifying the rival factions as the country's political leadership comes to grips with a more potent Hezbollah.

He was a compromise candidate agreed by the government coalition and opposition and in his first speech as president, he offered words to comfort both sides.

He praised Hezbollah's fight against Israel but also said there needs to be a dialogue over the future of its arsenal, a key majority demand.

He called for a close relationship with neighboring Syria, a major state supporter of Hezbollah which dominated Lebanon for almost three decades.

But he also backed the international tribunal to try the killers of former Prime Minister Rafik Hariri, a position aligned with that of the majority, which accuses Syria of killing him.

Syria has denied that, and the divisive issue sparked the political crisis 18 months when opposition ministers resigned.

Beirut's once-vibrant downtown had become a virtual ghost town because of an opposition sit-in there over the past 17 months. But over the weekend, it was coming back to life as restaurants and shops reopened and streets filled once again with strolling pedestrians.

Politicians are speaking optimistically about foreign investment and foreign tourists returning and injecting a much-needed boost into the economy.

"Suleiman's election in itself is a solution to the Lebanese crisis," said Hassan Ayyoub, a 20-year-old university student.

Heading with two friends to downtown Beirut late Sunday, he said he was confident the election "will lure tourists and investors back to the country and consolidate security and stability."

But Jihad Nasrallah, a 22-year-old university student, was among the few who think more trouble lies ahead.

Suleiman's election gives the country "a truce until next year's parliamentary elections after which the situation will blow up again," he predicted.

In Suleiman's hometown of Aamchit on the Mediterranean coast in the Christian heartland north of Beirut, church bells tolled, several thousand broke out in cheers and danced in the main square as they watched the vote on a giant screen.

Many waved Lebanese flags or those of Christian political parties in the fishing town. A group dressed in traditional baggy pants beat drums as others performed a sword folk dance.

Huge pictures of the new president, who must be a Christian under Lebanon's traditional power-sharing formula, towered over the town's main square and banners praised him.

"He is a symbol of the unity of Lebanon because he led the army," said Najwa Bishara, a young woman who said came by bus to Aamchit with other youths from the north to celebrate.

Security officials said five people were wounded in and near Suleiman's hometown by stray bullets.

In nearby regions, where Shiites are a minority, mosque minarets blared Quranic verses in a show of unity.

The relief was also evident in parliament, where political rivals smiled and shook hands, sitting together in the chamber to vote for the first time in 1 1/2 years. Foreign ministers of regional rivals Saudi Arabia, which backs the outgoing government, and opposition supporters Iran and Syria attended, as did the emir of Qatar.