BERKELEY, Calif. (AP) — For the first time in 20 years, police in the city of Berkeley can use pepper spray on violent demonstrators.

The City Council voted 6-3 Tuesday to allow police to use pepper spray to repel attacks on officers and others during the kind of violent protests that have rocked the city this year.

They still may not use it as an overall crowd-control method.

Officers were preparing for violence as soon as Thursday when conservative political commentator and former Breitbart editor Ben Shapiro appears on campus.

"It is a request made of urgency," Berkeley police Chief Andrew Greenwood said.

Shapiro is scheduled to speak at Zellerbach Hall at 7 p.m., upon the invitation of the Berkeley College Republicans and Young America's Foundation, a conservative student group. Shapiro was born in Los Angeles and attended UCLA, where at 17 he became the nation's youngest nationally syndicated columnist. He currently is editor-in-chief at The Daily Wire, a conservative news and opinion site.

Berkeley banned pepper spray in 1997 as a crowd-control weapon, even though most other law enforcement agencies permit officers to use it to disperse violent crowds, Greenwood said.

Greenwood sought such permission at an emergency council meeting, saying it is preferable to batons and tear gas, which the city is allowed to use but disburses far more widely than pepper spray.

The council said pepper spray "shall not be used as a crowd control technique to disperse a crowd or move a crowd," the motion stated. "Police may use pepper spray upon specific individuals within a crowd who are committing acts of violence upon police or others."

Berkeley police do carry small canisters of pepper spray for use on individual suspects. But the police chief said officers need permission to use bigger canisters if necessary.

Dozens of people lined up at City Hall to oppose arming Berkeley police with the larger canister of pepper spray, saying it is too easy for officers to use and has the potential to be used on peaceful protesters.

Some cities nationwide banned pepper spray after several high-profile incidents of police using it on peaceful protesters. An incident in which students at the University of California, Davis, were pepper-sprayed during a peaceful demonstration in 2014 led to a $1 million legal settlement for the protesters.

Ishmael Tarikh, a civil rights lawyer with the National Lawyers Guild, said police must issue a dispersal order before firing tear gas canisters. Tarikh said police don't have to issue a warning when using pepper spray.

"It's a blunt instrument used for a very precise problem," he said.

Four political demonstrations have turned violent in Berkeley since February, prompting officers to come up with new strategies to control rowdy and sometimes dangerous crowds. Berkeley police said they have not deployed tear gas at the other protests.

Police say they are struggling to balance free speech rights with preventing violence. Berkeley is facing a "large, armed coordinated group" at political events, Greenwood said.

"Our officers do not have the tools to address this threat," he said.

Joseph Giacalone, a professor at John Jay College of Criminal Justice and a former New York City police sergeant, said it would be advantageous for police to be able to use pepper spray during protests but tactical decisions should be made based on the conditions.

He said although tear gas and pepper spray often cause the same effects, shooting tear gas at a group of protesters often means spraying innocent bystanders and people frequently throw the cans back at officers.

"There are going to be bystanders in that crowd, and let's face it, the people you're trying to control come prepared for it. They have gas masks on," Giacalone said.

Later this month, a conservative group says it plans to bring former White House adviser Steve Bannon to speak on campus along with former Breitbart editor Milo Yiannopoulos and politically conservative commentator Ann Coulter.

A Yiannopoulos appearance on campus in February was canceled for safety reasons when protests turned violent and spilled into downtown Berkeley. Protesters smashed windows of businesses and marred walls with graffiti.

___

Associated Press writer Michael Balsamo in Los Angeles contributed to this report.