BAGHDAD -- Masked gunmen opened fire at Iraqi protesters in the Shiite holy city of Karbala on Tuesday, killing 18 people and wounding hundreds, security officials said, in one of the deadliest single attacks since anti-government demonstrations erupted earlier this month.

The overnight attack came as Iraqis took to the streets for a fifth straight day after a hiatus in the demonstrations that began earlier this month to protest government corruption, a lack of jobs and municipal services, and other grievances. The earlier protests also saw violence against protesters, and a total of 240 people have been killed since the unrest began.

But the bloodshed in Karbala could mark a turning point because of the high death toll and because the city is a major pilgrimage site where a revered Shiite figure was killed in a 7th century battle.

Similar anti-government protests are underway in Lebanon, where supporters of the Iran-backed militant group Hezbollah stormed the main protest camp and Prime Minister Saad Hariri said he would resign after hitting a "dead end" in trying to resolve the crisis. The protests in both countries are directed at governments and armed political factions that are close to Iran, raising fears of a violent backlash.

There were differing accounts and death tolls from Karbala, and details were still emerging from the scene.

Amid a clampdown by security forces, it was difficult to piece together what exactly prompted the attack. Eyewitnesses told The Associated Press that masked gunmen opened fire on the camp.

Protesters said they did not know if the masked men were riot police, special forces or Iran-linked militias. The protesters said Iraqi soldiers had been stationed around the protest site but withdrew after the attackers began firing tear gas and live ammunition.

Provincial Gov. Nassif al-Khutabi denied that any protesters were killed but said there were some injuries among security forces.

He said videos posted online were fabricated and not from Karbala. The footage purported to show the aftermath of the attack, with fires and people running away to the sound of heavy gunfire. Al-Khutabi's description contradicted those from people who were at the scene.

An AP video showed a nighttime fire and young protesters, some of them taking video with their cellphones, as gunfire echoes. An ambulance can be seen trying to drive amid the chaos, with Iraqi security forces arriving.

The leaderless and largely spontaneous protests across Iraq have been met with bullets and tear gas by security forces from the start.

At least 73 people -- not including the latest fatalities in Karbala -- have been killed since anti-government demonstrations resumed Friday, while 149 were killed during the earlier wave of protests this month.

Tuesday's attack happened in Karbala's Education Square, where protesters had set up tents for their sit-in.

One of the demonstrators said they were chanting slogans when an army unit arrived and that they gave the soldiers flowers and had friendly interactions. Then tear gas canisters came spiraling into the square, fired from the streets and alleys behind the soldiers, who then withdrew.

"We saw masked men dressed all in black and they fired live bullets toward the square," the protester said. "People fell dead and wounded right next to me. We tried to escape but when we fled into the alleys we ran into moving checkpoints set up by these forces. They arrested people and searched their phones for video of what had happened."

Another witness said hundreds of protesters were in the encampment when someone opened fire from a passing car. Then, masked gunmen in black plainclothes started shooting at the protesters, and the tents caught fire.

Both witnesses spoke on condition of anonymity because they feared reprisal. The death toll was confirmed by Iraqi security officials, also speaking anonymously, because they were not authorized to talk to reporters.

Amnesty international blamed Iraqi security forces and quoted witnesses as saying the attackers ran down demonstrators with their vehicles. It said several demonstrators were detained and beaten.

"Iraqi forces opened live fire on peaceful protesters and resorted to excessive and often lethal force to disperse them in a reckless and utterly unlawful manner," said Lynn Maalouf, Amnesty's Middle East research director. "These scenes are all the more shocking as they come despite assurances from Iraqi authorities that there would be no repeat of the extreme violence used against demonstrators during protests earlier this month."

The anti-government protests in Karbala, Baghdad and cities across southern Iraq have often turned violent, with security forces opening fire and protesters torching government buildings and headquarters of Iran-backed militias.

The demonstrations have occurred in Shiite-majority areas and have been directed at the Shiite-dominated government and Shiite political parties and militias, many of which are supported by neighbouring Iran.

In Tehran, the Foreign Ministry warned Iranians against travelling to Iraq and asked them to postpone their trips until further notice, according to the state-run IRNA news agency.

Karbala is one of the holiest places in Shiite Islam, where Hussein, the grandson of the Prophet Muhammad, was killed in battle in the year 680, a formative event in the schism between Shiite and Sunni Muslims. Hundreds of thousands of Shiites flock to the city every year to commemorate his martyrdom.

The overwhelming majority of the residents in Karbala and the city's security forces are Shiite.

The demonstrations are fueled by anger at corruption, economic stagnation and poor public services. Despite its vast oil wealth, Iraq suffers from high unemployment and crumbling infrastructure, with frequent power outages that force many to rely on private generators.

The protests have grown and demonstrators are now calling for sweeping changes, not just the government's resignation. Prime Minister Adel Abdul-Mahdi has promised a government reshuffle and reforms, which the demonstrators have already rejected.

Authorities on Monday imposed a midnight-to-6 a.m. curfew in Baghdad, as renewed protests raged there and across the south.

Students skipped classes at several universities and secondary schools in Baghdad and across southern Iraq to join the protests Monday, despite the government ordering the institutions to operate as normal. A senior security official estimated that 25,000 people protested in the capital that day.

Three people were killed, including a 22-year-old female medical student, the first woman to die since the protests began earlier this month. Seventeen students were among the wounded.

------

Associated Press writers Zeina Karam and Joseph Krauss in Beirut and Amir Vahdat in Tehran, Iran, contributed.