CHICAGO - A white Chicago police officer who shot a black teenager 16 times last year was charged with first-degree murder Tuesday, hours before the city released a video of the killing that many people fear could spark unrest.

City officials and community leaders have been bracing for the release of the dash-cam video, fearing the kind of turmoil that occurred in cities such as Baltimore and Ferguson, Missouri, after young black men were slain by police or died in police custody.

A judge ordered that the recording be made public by Wednesday. Moments before it was released, the mayor and the police chief appealed for calm.

"People have a right to be angry. People have a right to protest. People have a right to free speech. But they do not have a right to ... criminal acts," Police Superintendent Garry McCarthy said.

The relevant portion of the video runs for less than 40 seconds and has no audio.

Laquan McDonald, 17, swings into view on a four-lane street where police vehicles are stopped in the middle of the roadway. As he jogs down an empty lane, he appears to pull up his pants and then slows to a brisk walk, veering away from two officers who are emerging from a vehicle and drawing their guns.

Almost immediately, one of the officers appears to fire from close range. McDonald spins around and crumples to the pavement.

The car with the camera continues to roll forward until the officers are out of the frame. Then McDonald can be seen lying on the ground, moving occasionally. At least two small puffs of smoke are seen coming off his body as the officer continues firing.

In the final moments, an officer kicks something out of McDonald's hands.

Police have said the teen had a knife. Cook County State's Attorney Anita Alvarez said Tuesday that a 3-inch knife with its blade folded into the handle was recovered from the scene.

Shortly after the video's release, protesters began marching through city streets. Several hundred people blocked traffic on the near West Side. Some circled police cars in an intersection and chanted "16 shots."

"I'm so hurt and so angry," said Jedidiah Brown, a South Side activist and pastor who had just seen the video. "I can feel pain through my body."

Small groups of demonstrators marched up Michigan Avenue with a police escort before being stopped by officers as they headed toward Lake Shore Drive. After a short standoff, the crowd turned around.

At one point, demonstrators also gathered outside the police department's District 1 headquarters in the South Loop. Officers formed a line in front of the building, blocking anyone from entering.

Later, again along Michigan Avenue, at least one person was detained, which led to a tense moment as protesters tried to prevent police from taking him away. Some threw plastic water bottles at officers and sat behind a police vehicle, refusing to move. Officers pulled them away, and the vehicle sped off.

Protests had mostly dissipated by 11 p.m., with a much smaller group planning to return to the District 1 building.

City officials spent months arguing that the footage could not be made public until the conclusion of several investigations. After the judge's order, the investigations were quickly wrapped up and a charge announced.

Alvarez defended the 13 months it took to charge officer Jason Van Dyke. She said cases involving police present "highly complex" legal issues and that she would rather take the time to get it right than "rush to judgment."

Alvarez said concern about the impending release prompted her to move up the announcement of the murder charge.

"It is graphic. It is violent. It is chilling," she said. "To watch a 17-year-old young man die in such a violent manner is deeply disturbing. I have absolutely no doubt that this video will tear at the hearts of all Chicagoans."

But she insisted that she made a decision "weeks ago" to charge Van Dyke and the video's ordered release did not influence that.

Some community leaders said there was no doubt that Alvarez only brought charges because of the order to release the video from Oct. 20, 2014.

"This is a panicky reaction to an institutional crisis within the criminal-justice system," said the Rev. Jesse Jackson, who said he hoped to see "massive" but peaceful demonstrations.

Months after McDonald's death, the city agreed to a $5 million settlement with his family, even before relatives filed a lawsuit.

The city's hurried attempts to defuse tensions also included a community meeting, official statements of outrage at the officer's conduct and an abrupt announcement Monday night that another officer who has been the subject of protests for months might now be fired.

"You had this tape for a year, and you are only talking to us now because you need our help keeping things calm," the Rev. Corey Brooks said of Monday's community gathering with the mayor.

An autopsy report showed that McDonald was shot at least twice in his back and PCP, a hallucinogenic drug, was found in his system.

At the time of his death, police were responding to complaints about someone breaking into cars and stealing radios.

Van Dyke, who was denied bond on Tuesday, was the only officer of the several who were on the scene to open fire. Alvarez said the officer emptied his 9 mm pistol of all 16 rounds and that he was on the scene for just 30 seconds before he started shooting. She said he opened fire just six seconds after getting out of his vehicle and kept firing even though McDonald dropped to the ground after the initial shots.

At Tuesday's hearing, Assistant State's Attorney Bill Delaney said the shooting lasted 14 or 15 seconds and that McDonald was on the ground for 13 of those seconds.

Van Dyke's attorney, Dan Herbert, maintains his client feared for his life and acted lawfully and that the video does not tell the whole story. Van Dyke, stripped of his police powers, has been assigned to desk duty since the shooting.

Herbert said the case needs to be tried in a courtroom and "can't be tried in the streets, can't be tried on social media and can't be tried on Facebook."

Chicago police also moved late Monday to discipline a second officer who shot and killed an unarmed black woman in 2012.

McCarthy recommended firing officer Dante Servin for the shooting of 22-year-old Rekia Boyd, saying Servin showed "incredibly poor judgment." A judge acquitted Servin of involuntary manslaughter and other charges last April.

-----

Associated Press writers Sophia Tareen, Michael Tarm and Carla K. Johnson contributed to this report.