BAGHDAD — Iraqi security forces imposed a round-the-clock curfew in Baghdad and fired live rounds and tear gas on Thursday to disperse anti-government protests that have gripped the country since earlier this week, killing 21 people so far.

In a desperate attempt to quell the demonstrations, which were spontaneous and mostly spurred by woes over deteriorating economy and lack of jobs and services, authorities have cut internet access across much of Iraq.

Before dawn, explosions were heard inside Baghdad’s heavily fortified Green Zone, home to government offices and foreign embassies. The U.S.-led coalition said an investigation is underway, adding that no coalition forces or assets were hit.

So far, at least 21 people have been reported killed and hundreds have been wounded since the violence and clashes between security forces and anti-government demonstrators first erupted on Tuesday.

Twelve people were killed late Wednesday in the southern cities of Nasriyah, Kut, and Amara. The dead were protesters and one policeman, according to security officials.

Iraq’s state news agency said Parliament Speaker Mohammed al-Halbusi invited representatives of the protesters to come to the parliament building to discuss their demands.

The protests, concentrated in Baghdad and in predominantly Shiite areas of southern Iraq are mostly spontaneous and without political leadership, staged by disenchanted youth demanding jobs, improved services, such as electricity and water, and an end to Iraq’s endemic corruption.

They have organized the protests on social media and have gradually escalated their demands and now want the government to resign. No political party has so far joined the campaign.

The demonstrations and the unrest are the most serious challenge to Prime Minister Adel Abdul-Mahdi’s year-old government, which has been caught in the middle of U.S.-Iran tensions in the Middle East. Iraq is allied with both countries and hosts thousands of U.S. troops, as well as powerful paramilitary forces allied with Iran.

Also Thursday, Iraq’s foreign ministry summoned Iran’s ambassador to Baghdad to denounce his threat that Tehran would retaliate to an American attack anywhere in the world, including in Iraq. A ministry statement said Iraqi official Abdul-Karim Hashem told Iran’s envoy, Iraj Masjedi, that American troops are in Iraq and the request of the Iraqi government and that Iraq will not accept becoming an arena for international conflicts.

Masjedi recently told Iraq’s Dijla TV that if the Americans attack Iran, Tehran “will strike back anywhere, including (in) Iraq.”

The Baghdad curfew was announced early Thursday following a meeting of Iraq’s top leaders to discuss anti-government protests that have engulfed the country.

Authorities say it is meant to “protect general peace” and protesters from “infiltrators” who committed attacks against security forces and public property. It excludes travelers to and from the Baghdad airport and Iraqi Airways said flights were operating as scheduled.

Baghdad’s main streets were largely deserted Thursday morning. In central Tahrir Square, hundreds of young protesters were gathered, and police fired tear gas canisters every now and then.

Iraqi army vehicles were also seen moving in the streets of the capital and in some areas, they blocked side roads with barbed wire.