COLUMBIA, S.C. (AP) — Hundreds of cities have imposed curfews to keep the peace during a week of violent unrest across the U.S., employing a tactic that gives law enforcement sweeping arrest powers but is frequently flouted and criticized as being unconstitutional.

From New York City to Fargo, North Dakota, cities large and small have put curfews in place — in some cases for the first time in decades — sending out emergency notices on phones and highway signs urging people to stay off the streets.

But the deadlines aren’t hard and fast — many of them have exceptions for people heading to and from work, reporters, public transportation and even people buying groceries. Many protesters and citizens have routinely disregarded the restrictions, and police have allowed peaceful demonstrations to continue after curfew while focusing their attention on violent unrest.

In New York City, an 11 p.m. curfew was originally put in place this week for what appeared to be the first time in nearly 80 years. Mayor Bill de Blasio rolled it back to 8 p.m., but thousands of people defied the curfew Tuesday night, continuing to march in parts of Brooklyn and Manhattan. After initially standing by and letting protesters continue, officers began ordering people to leave and some people were taken into custody.

On an overall calmer night in New York City, de Blasio said the relative quiet was due partly to the curfew. ” So far, the curfew is certainly helping, based on everything I’ve seen in Brooklyn and Manhattan over the last three hours,” de Blasio tweeted.

A curfew allows police the ability without any other reason to threaten to arrest or detain crowds of protesters that linger or groups that appear to be a danger to order. And curfews can be a deterrent to get law-abiding citizens off the street and allow police to focus their efforts on the unrest and not get bogged down in run-of-the-mill violations.

They have been installed in Los Angeles, Atlanta, Detroit, Denver, Philadelphia and hundreds of other cities and communities across the country.

Curfews aren’t unusual in the United States but are typically used in natural disasters like hurricanes, floods and tornadoes to allow law enforcement to stop anyone on the streets and prevent stealing when many homes and empty or damaged. New York City has used curfews in specific locations like parks — sometimes with controversial results.

The 1988 Tompkins Square Park riot in Manhattan had to do in part with a then-newly imposed 1 a.m. parks department curfew in a bid to rid the park of drugs and crime. In enforcing the curfew, police flooded the park with officers and were accused of rampant abuses.

Former Mayor Rudy Giuliani ramped up enforcement of Central Park’s nightly closure after a string of robberies in the late 1990s. Giuliani was so strict about the curfew, he wouldn’t grant an exception for a late-night vigil to John Lennon, despite intercession from the lord mayor of Liverpool on behalf of aggrieved Beatles fans.

During the unrest of the past week, police also want bystanders off the street during unrest — and the curfew solves that.

“The curfew really is to keep people from coming sort of to gawk at what’s going on and keep the looky-loos away,” said Sacramento City Councilman Steve Hansen, whose city’s 8 p.m. Monday curfew appeared to help prevent the destructive demonstrations from the night before.

The curfews also come on the heels of lockdowns and stay-at-home orders imposed during the coronavirus pandemic, making for an unprecedented stretch in cities like New York.

In Columbia, South Carolina, officials lifted a weekend curfew and the mayor joined an afternoon protest at the state capitol calling for police reform. But several dozen people stayed for hours after the protest ended as tensions with police grew as shadows got longer.

Just before 7:30 p.m. Monday, Columbia, South Carolina , Mayor Steve Benjamin set a curfew for 7:45 p.m. for a small area of downtown and an areas of restaurants and shops. The city sent an emergency notice and protesters looked at their screens as their phones started to buzz and the curfew set in. The protesters immediately started to walk away.

But some civil rights organizations think hastily issued curfews are unfair and against the First Amendment of the Constitution.

“By making presence on public streets anywhere in these cities unlawful, these measures give police too much discretion over whom to arrest,” said the American Civil Liberties Union of Northern California after a number of cities issued curfews.

New York City on Monday found out an unintended consequence of a curfew is keeping away law-abiding protesters. The night before, they banded together to stop vandalism and help police find lawbreakers.

It also sends a subtle message, said New York City Council member Ydanis Rodriguez.

“Implementing a curfew and increasing the number of police officers patrolling the streets is a tactic to effectively silence the voices raised in protest against the abuse of power and looting of black and colored bodies by members of the police,” Rodriguez said.

Curfews can cause other problems too. Charleston, South Carolina, had a curfew for three days after late night Saturday protests led to shattered windows for restaurants and businesses and stolen merchandise downtown.

Monday night was quiet. And Charleston Mayor John Tecklenburg said he immediately heard from a certain group of people.

“We want to give our businesses a chance to get back into business,” Tecklenburg told his City Council at a Tuesday meeting lifting the curfew.

A curfew also allows police to separate people who want to protest while following the law from people who want to cause harm, said Tamara Herold, an assistant professor in the Criminal Justice Department at the University of Nevada-Las Vegas. That makes it easier for law enforcement to decide how to use force to break up unrest.

“One of the things police always want to avoid is using indiscriminate force against a large crowd,” Herold said.