Hussein Malla, Associated Press
A Lebanese Shiite supporter of Hezbollah, right, with mud on his face brought from Karbala, according worshippers, listens to the story of Imam Hussein, as other man, left background, wave a religious flags during the holy day of Ashoura, in the southern suburb of Beirut, Lebanon, Tuesday Nov. 4, 2014. Shiites mark Ashoura, the tenth day of the Islamic month of Muharam, to commemorate the Battle of Karbala in the 7th century when Imam Hussein, a grandson of Prophet Muhammad, was killed in present-day Iraq.

BEIRUT — Hundreds of thousands of Shiite pilgrims flocked Tuesday to an Iraqi holy city for the peak of a 10-day religious ritual amid tight security over fears of sectarian attacks — the first time Ashoura has been observed since Sunni extremists seized much of northern and western Iraq.

The militants, who view Shiites as apostates deserving of death, claimed responsibility for two bombing attacks against pilgrims that killed 23 people in Baghdad on Sunday. They have systematically massacred thousands of their opponents, including Sunni rivals, in Iraq and Syria and are battling Lebanese army troops near the country's border with Syria.

Ashoura rituals were so far peaceful in the city of Karbala, 50 miles (80 kilometers) south of Baghdad, as more than 30,000 Iraqi troops were deployed to protect the worshippers. The occasion marks the anniversary of the death in the seventh century of the Prophet Muhammad's grandson, Imam Hussein, in a battle outside Karbala — which sealed Islam's historic Sunni-Shiite split. Shiite festivals in Iraq have often been attacked by Sunni extremists.

In Lebanon, where sectarian tensions are high over the civil war in Syria, tens of thousands of supporters of the Shiite militia Hezbollah turned out in the group's stronghold in southern Beirut amid unprecedented security measures.

The annual mournful Shiite march of men beating and whipping themselves is being carried out with a sense of triumph this year in the country, home to a large Shiite minority.

The group's participation in the Syrian war alongside President Bashar Assad's forces against mainly Sunni rebels trying to topple him is highly divisive in Lebanon. Critics say the decision has dragged Lebanon into the fray, triggering suicide and other attacks against Shiite strongholds in the country.

But many supporters of the group backed Hezbollah's participation in the war, adopting its narrative that the intervention in Syria was necessary to keep Sunni extremists such as the Islamic State group from invading Lebanon and committing massacres as it has done in Syria and Iraq.

Now many say they feel vindicated, with Lebanon's army and Hezbollah fighters battling Sunni militants in the country's north.

"What is happening around us increases our conviction and faith that our choices were right," the Hezbollah leader, Sheik Hassan Nasrallah, told tens of thousands of supporters Tuesday.

Speaking via satellite link through a huge video screen, he said takfiris — a term for Islamic extremists — will be defeated everywhere. "And we will have the honor of having been part of their defeat," he said.

Nasrallah dismissed reports that Hezbollah will withdraw from Syria because it was sapping the group's resources as "dreams."

Security was unprecedented. Security forces and Hezbollah agents sealed off entrances to the sprawling Shiite stronghold in southern Beirut known as Dahyeh as of Monday night. Trucks filled with sand and cement were parked at the entrances to lessen the impact of potential bombings and pedestrians were meticulously searched.

In Karbala, men, mostly wearing robes, pounded their chests, slashed their heads and beat their bloodied foreheads with the flat sides of swords and knives.

Mourners waved Iraqi and Shiite religious flags as they ran toward the Imam Hussein holy shrine.

The crowds chanted: "Hussein... Hussein," as army helicopters hovered over the area to provide protection for the pilgrims.

Yacoub reported from Baghdad.