Mahmoud Ahmadinejad was sworn in Wednesday for a second term as president nearly two months after a disputed election triggered massive street protests, split Iran's clerical leadership and brought attacks from within his own conservative camp over mistreatment of detained opposition activists.

In streets near parliament, security forces using batons dispersed hundreds of protesters who chanted "Death to the Dictator," witnesses said. Some wore black T-shirts in a sign of grief and others wore green — the color of the opposition movement. A middle-aged woman carried a banner warning Iran's leaders if they do not listen to people's demands, they will face the same fate as Shah Mohammad Reza Pahlavi, who was toppled in the 1979 Islamic Revolution.

Key opposition leaders, moderate lawmakers and all three of Ahmadinejad's election challengers boycotted the swearing in ceremony. State-run Press TV said more than 5,000 security forces deployed around the parliament building and police with sniffer dogs patrolled the area after the opposition called for demonstrations to coincide with the inauguration.

In his inaugural address, Ahmadinejad seemed to tone down his often-bellicose rhetoric and emphasized his plans to improve the faltering economy. He demanded that Iran be on an equal footing with other world powers and denounced foreign interference. The government has accused the U.S. and the West of backing street protests.

"We must play a key role in the management of the world," Ahmadinejad said. "We will not remain silent. We will not tolerate disrespect, interference and insults," he added. "I will spare no effort to safeguard the frontiers of Iran."

He did not directly address President Barack Obama's outreach for the start of a dialogue on Iran's contentious nuclear program, which the U.S. suspects is geared toward producing weapons.

But he said: "Iran is a nation of logic, dialogue and constructive interaction. The basis of our foreign policy is wide and constructive contacts with all nations and independent governments based on justice, respect and friendship."

The U.S. administration has given Iran a vague deadline of September to respond positively to the outreach or face stiffened sanctions. But U.S. Secretary of State Hillary Rodham Clinton acknowledged recently that the election turmoil appears to have paralyzed decision-making on the U.S. offer.

"I don't think they have any capacity to make that kind of decision right now," Clinton said.

Iran's detention last week of three Americans who strayed across the border while hiking in northern Iraq has added a new point of friction in relations with the U.S.

Ahmadinejad mentioned the election crisis only in passing, without direct reference to the opposition or the huge street protests and clashes since the June 12 vote. The opposition claims Ahmadinejad was re-elected by fraud and pro-reform leader Mir Hossein Mousavi was the true winner.

Ahmadinejad said the Iranian people were the main winners of the vote and foreign enemies stirred up "plenty of dust" that clouded the issue.

"They raised many questions on it and tried to portray a dark future," he said.

In an apparent warning to demonstrators, he said his government would "resist any violation of law and interference."

But he also urged unity.

"We should join hands as we move forward to fulfill our goals," he said.

Ahmadinejad noted that some Western countries — the U.S. among them — did not congratulate him on his election win.

"Some countries have not recognized the elections or extended their congratulations. They do not respect the rights of other nations, yet they recognize themselves as the yardstick for democracy," he said, without naming the specific countries.

"Nobody in Iran is waiting for anyone's congratulations," he added, to cheers from lawmakers.

In contrast to past inauguration ceremonies, former presidents Akbar Hashemi Rafsanjani and Mohammad Khatami were absent. They are two of the most powerful supporters of the opposition. Mousavi and another pro-reform defeated presidential candidate, Mahdi Karroubi, also stayed away.

The only other conservative candidate in the election, Mohsen Rezaei, also was absent. Rezaei, once commander of the powerful Revolutionary Guards, has been the most outspoken critic of Ahmadinejad and the election from within the president's own conservative camp. He has led demands for high-level probes into abuses after the son of his top aide died in detention. He was arrested during a protest.

Parliament speaker Ali Larijani said 273 out of total 290 Iranian lawmakers were present in the ceremony. But a Web site of opposition in parliament said 53 of its lawmakers were not there. It said some of them had walked out in protest when Ahmadinejad began speaking.

Hundreds of police deployed around parliament and two subway stations nearby were closed to the public. Witnesses said at least 10 people were detained by police. Authorities have banned foreign media from going out to cover any opposition activities, forcing them to rely on witness accounts and tightly controlled state media.

In the days leading up to the inauguration, opposition groups had called protesters into the streets to coincide with the swearing in, spreading the word through postings on reformist Web sites and blogs.

The calls showed the protesters resolve to keep confronting the government even though a harsh crackdown by security forces on any street demonstrations has killed at least 30, according to Iran's official toll. Human rights group suspect the death toll is far higher.

The opposition, and some powerful conservatives, have also been angered by a mass trial for more than 100 pro-reform figures and protesters set to resume Thursday. Among those on trial are many prominent reformist activists and political figures, accused of challenging the Islamic system.

The trial added to the rifts within Iran's leadership over its handling of the most serious domestic upheaval since the 1979 Islamic Revolution.

Still Ahmadinejad sought in his speech to show he was moving ahead as a strong and legitimate leader despite the election turmoil. For much of the address, he focused on bringing economic and social justice in Iran, fighting corruption and improving the economy. Those promises reflected the populist platform that has gained him broad support among the country's poor, many of whom feel that Iran's elite have made themselves rich off corruption.