Clashes broke out between masked protesters and police here early Thursday after a day of peaceful anti-Wall Street protests shut down one of the United States' busiest ports.

The demonstrations were mainly peaceful until around midnight, when dozens of protesters in the city center hurled rocks and bottles, briefly occupied a vacant building and torched a barricade. Riot police responded with tear gas.

The violent protesters appeared to be a breakaway group from the much larger Occupy Wall Street movement that has been camped out near Oakland's City Hall, many of whom rushed to the scene to urge calm, an AFP photographer said.

The Oakland Tribune reported that one protester was injured and later taken away by an ambulance, and that police had arrested 30 to 40 people. The Oakland police could not immediately be reached for comment.

California's port of Oakland -- which does 59 percent of its trade with Asia and is the fourth busiest US port -- had sent staff home early on Wednesday as hundreds of protesters besieged the docks.

"Maritime operations remain effectively shut down," said a Port of Oakland statement in an update late Wednesday night, adding that services "will not resume until it is safe and secure to do so.

"Our hope is that the work day can resume tomorrow and that port workers will be allowed to get to their jobs without incident," it said, adding that there had been no injuries, property damage, or major security problems.

The dockside shutdown came after thousands of people rallied in the city center during the day to support a strike called after police fired tear gas while clearing a protestors' camp last week, injuring one person.

"Celebrate the death of capitalism," read a banner on a makeshift altar decorated with flowers. Vendors sold ice cream and cotton candy, music blared, and booths handed out anti-capitalist literature.

Brother Muziki, an elementary school teacher, was helping carry a banner reading: "Bail out schools and services, not banks!"

"Our classrooms are overcrowded, he said. "The banks are being bailed out -- but not the schools."

While the protests were mainly peaceful, some acts of vandalism were reported, targeting closed-up bank branches downtown.

At one point some 200 people chanted outside a Wells Fargo branch, which had graffiti scrawled on its walls reading: "The 1 percent won’t back down" and "Who’s robbing who?" according to local CBS television.

The protesters had headed towards the port from 4:00 pm, splitting up when they got there into a number of different groups blockading different terminals by early evening -- at which point the port declared itself effectively closed.

A line of several dozen riot police in gas masks blocked the march at one point during the day but later dissipated without conflict, and most protesters did not even come close to police lines.

Local media reported that two protesters had been hit by a car and taken to hospital with non-life threatening injuries.

With their mission accomplished by late evening, the protesters began heading back downtown as police blocked freeway entrances.

In the Frank Ogawa Plaza outside City Hall -- where violence flared last week after riot police moved in to clear a two-week old camp -- the Occupy encampment had expanded back to more than 50 tents.

Late Wednesday night, before the violence broke out, the protesters had played music and milled about the square in a festive atmosphere.

Jessica Callahan, 20, said she thought the strike day had been a success for Oakland, which has been hard-hit by the global recession.

"A lot of people doubt Oakland," she said. "But we can come together and we need to."

Inside the port -- which handles some $39 billion in imports and exports per year and generates tens of thousands of jobs in the area -- authorities said they hoped operations would get back to normal on Thursday.

"Continued missed shifts represent economic hardship for maritime workers, truckers, and their families, as well as lost jobs and lost tax revenue for our region," they said.