Two decades ago, amid a growing controversy over police shootings in the nation’s capital, officers in the District were largely barred from firing at moving cars.

The rules didn’t apply if someone in the car was firing at police, but officials concluded that in most cases, the practice was dangerous and ineffective. Bystanders could be hit, and shooting at a car usually didn’t stop it anyway. Other departments nationwide adopted similar policies.

Now, however, several major cities are loosening those rules to deal with a new threat: terrorists in trucks mowing down and killing pedestrians. Police in Washington, New York City, Chicago and Las Vegas have begun allowing officers to fire at moving vehicles to stop such ramming attacks. While concern about the tactic remains, authorities say that, in extreme instances, trying to shoot the driver might be the only way to save lives.

“We have to balance the threat to the community with the idea we don’t want to use fatal force unless we absolutely have to,” said D.C. Police Chief Peter Newsham. “It’s really important to make sure officers completely understand this is a special circumstance, a last resort, but one that may be necessary.”

The move to broaden the circumstances under which officers are authorized to use deadly force comes as police nationwide have been under scrutiny for the shootings of unarmed people, many of them black men.

Sam Sinyangwe, a data analyst and activist for the national group Campaign Zero, which calls for an end to police violence, said the group is concerned that any loosening of restrictions could embolden officers to pull their guns unnecessarily.

“What we’ve seen is a shift backward on this issue,” Sinyangwe said. He said the new policies, though made with the goal of combating terrorism, could cover incidents “that are not terrorist situations.”

Some law enforcement officials, experts on policing and chiefs say the new rules on police shootings should be tailored as narrowly as possible. A Washington Post database tracking shootings by police since 2015 shows that deadly shootings by officers number about 980 a year nationwide.

Even with the practice of shooting at moving vehicles largely banned, it has proved a difficult tactic to stop. Between January 2015 and May 2017, The Post found that police across the country fatally shot at least 193 people who were inside vehicles. In 76 of those cases, the person killed was not armed and only the vehicle was considered the weapon. Police acknowledged that in 17 of those cases, the person shot was fleeing.

Chuck Wexler, the executive director of the D.C.-based Police Executive Research Forum, which advises agencies on best practices, said that departments need to be “very careful about making adjustments that could be misinterpreted and potentially lead to bad shootings.” In 2016, PERF called for a prohibition on police shooting at moving vehicles unless those inside were using a weapon.

Charles H. Ramsey, who led the D.C. police department during its changes in the late 1990s and early 2000s and later headed President Barack Obama’s Task Force on 21st Century Policing, said later revisions make sense given the terrorist attacks. But he warned that departments need to craft specific rules “so we don’t get back to the days of shooting at vehicles just because they are stolen.”

Police stressed that they already take considerable steps to prevent ramming attacks at high-profile events where large numbers of people will gather. At President Trump’s inauguration in Washington, for instance, and during festivals and street races, concrete barriers were erected and large trucks were used as blockades. Officials in New York used sand-filled trucks to help protect the city’s massive New Year’s Eve celebration in Times Square. And officials in both cities have more recently expanded parking restrictions around special events.

But if those efforts fail, and an officer happens to be there, shooting at a moving vehicle may be “the only tactic that’s available,” said J. Thomas Manger, president of the Major City Chiefs Association, a group of police executives from the nation’s largest law enforcement agencies. He added that police leaders “want to make sure we’re not putting police officers at a disadvantage or restricting them from doing what needs to be done.”

The death toll in such attacks is mounting — 10 dead in Toronto last month; 86 dead in the French Riviera city of Nice in 2016; 12 dead at a Christmas market in Berlin, also in 2016; and eight dead on a bicycle path in Lower Manhattan last year.

Las Vegas revised its policy in September, saying the change was due to terrorist incidents. A spokesman also mentioned a 2015 incident in which a woman believed to be high on drugs drove along a crowded sidewalk, striking 30 pedestrians and killing one. The city now permits officers to shoot at moving vehicles if it is “absolutely necessary to preserve human life.”

The new directive for officers in New York City — which first banned officers from shooting at vehicles in the 1970s — says they should now take such action only “to terminate a mass casualty terrorist event.” The rules stress that such an attack “is the type of extraordinary event that this clause was intended to address.”

Police in the District entered into a consent decree with the Justice Department after a series in The Post in 1998 documented officers having shot and killed people at a greater rate than any other big-city force. In a five-year period around that time, District officers shot at moving vehicles 54 times, The Post found, killing nine people and injuring 19 more. Among them were three teenagers, all unarmed.

Training, internal investigations and hiring were improved, and new rules of engagement made policies clear. The number of shootings by D.C. police has decreased from about 30 a year in the 1990s to about five a year.

Newsham, the District’s police chief, said the new orders allowing officers in rare instances to shoot at moving vehicles are meant only for large-scale “ramming attacks.” The District’s use-of-force directive, revised in November, defines a ramming attack as one “in which a perpetrator deliberately rams, or attempts to ram, a motor vehicle at a crowd of people with the intent to inflict fatal injuries.”

Newsham stressed that the rules still inform officers that in most cases a vehicle alone can’t be considered a weapon and they should “avoid tactics that could place them in a position where a vehicle could be used against them.”

But the policy change has already been cited by one D.C. police officer facing termination for fatally shooting a motorcyclist who he said purposely rammed his cruiser. The officer, Brian Trainer, fired twice, killing 31-year-old Terrence Sterling in September 2016. D.C. police officials repeatedly recited the ban on shooting at moving vehicles as they argued during a recent administrative hearing that Trainer’s actions broke policy.

Trainer’s attorney argued at the hearing that while the shooting occurred before the use-of-force directive was updated, the revision supports the officer’s argument that a vehicle by itself can in fact be used as a weapon and that the department thinks so as well.

A city attorney for the attorney general’s office, Nada Paisant, countered at the hearing that the policy revision is directed at stopping a terrorist attack in which “a vehicle is endangering pedestrians.”

James O. Pasco Jr., the executive director of the national Fraternal Order of Police, said he believes there is growing agreement that the ban on shooting at moving vehicles needs to be modified.

“Police standard operating procedures have to reflect present-day life,” Pasco said. Unlike police executives, he urges that any changes be as broad as possible. “It is extraordinarily difficult for an officer to ascertain when a vehicle coming at him or at innocent civilians is intending to commit terrorism or escape a bank robbery,” he said.

William Terrill, a professor of criminal justice at Arizona State University who studies police use of force, said carefully written changes seem appropriate given threats of mass killings using vehicles. But he cautioned that they will have only an instant to judge a driver’s intent.

“You still have officers out in the field who have to make this decision in a very quick amount of time,” Terrill said.

Dan Morse contributed to this report.