Officers moved in near the protesters' City Hall encampment Wednesday night, where tents sprouted anew after officials last week ordered them razed.

The police action came after a mostly peaceful day of protest that attracted more than 7,000 people.

The evening appeared to be winding down peacefully when protesters declared victory at the Port of Oakland at 9 p.m. Wednesday -- after authorities confirmed that a shift of port workers scheduled to start work at 7 p.m. had been canceled.

But as demonstrators massed again at the City Hall plaza, the situation devolved.

The Occupy Oakland demonstrators managed to gain entry to an empty building that had housed the Travelers Aid Society, a nonprofit organization that assists the homeless but had suffered funding cuts.

Leaflets indicated that protesters had targeted the building for "reuse."

They branded it a new "community center" in Twitter feeds. Video from a local ABC affiliate's helicopter showed jubilant crowds flowing in and out of the building, where a banner marked "Occupy Everything" hung.

Others built a barricade nearby, presumably to discourage police. Shortly before midnight, local media reported that police officers from various agencies were suiting up in riot gear.

Some demonstrators set the barricade aflame. Firefighters doused it. A police statement later said protesters had hurled rocks, explosives, bottles and flaming objects at officers.

Live video from a man who called himself @OakFoSho on Twitter, beamed to thousands of viewers into the early hours Thursday, showed Alameda County sheriff's deputies and Concord police officers among those who surrounded the crowd on Broadway near Telegraph Avenue.

At 1:14 a.m., however, a loud explosion could be heard on the video coming from the encampment. Oakland police, who had maintained a low profile all night, lined the plaza.

Groggy people in tents could be heard telling police to go deal with troublemakers instead. One protester was hit in the leg with some kind of projectile.

Video showed him running, then standing doubled over, whimpering in pain, as others from the encampment rushed to help him. "You just fired on and injured an unarmed person," one man could be heard yelling.

The Oakland Tribune reported that the man was taken away in an ambulance after fellow demonstrators repeatedly asked for help. By 1:48 a.m., officers on Broadway could be heard issuing a dispersal order. It was unclear whether police would attempt to clear the plaza or were just trying to clear demonstrators who were in the streets. At 2 a.m., demonstrators called on one another to "remain nonviolent."

They chanted, "We are Scott Olsen," in reference to the Iraq war veteran who was injured by a police projectile last week. Images of that police action, which came in response to demonstrators about 12 hours after the camp was razed, were beamed around the world. Police maintain that they were defending themselves against some in the crowd who threw bottles, rocks and other objects, but criticism was widespread that nonviolent demonstrators had been caught up in the assault.

Wednesday's action drew more than 7,000 people, including teachers, youths, seniors, union members and other citizens who said they were concerned about economic inequality.

[For the record, 7:29 a.m. Thursday: A previous version of this post said protesters were waiting for a change in shift of officers; they were waiting for a change in shift of port workers.]