Turkish riot police used clubs, tear gas and water cannons Thursday to break up crowds of workers and students trying to reach a main Istanbul square for a Labor Day rally banned by the government.

Authorities said 505 demonstrators were detained and six police officers were injured. HaberTurk television said 30 people were injured.

• Click here to view pictures from May Day clashes in Germany and Turkey.

Thousands of police were on the street after Turkish unions said they would defy the government and hold May Day celebrations in Istanbul's Taksim square, which had been the scene of violent protests decades ago.

The unions later declared they were abandoning plans to march to the square because of strong police resistance. Some leftist groups, however, still tried to reach it, advancing down main avenues holding sticks, bricks and rocks and their faces covered with handkerchiefs.

The government had banned celebrations at the square, citing security concerns, and asked labor unions to hold festivities at other locations. The government reinforced the Istanbul police force with teams from other cities and a police helicopter hovered above the city center.

Officials set up barricades in and around the square where May Day celebrations have been banned since 1977, when unknown gunmen opened fire on demonstrators, killing 37 people.

"Long live May 1!" and "Everywhere is Taksim!" the protesters shouted Thursday, in addition to slogans denouncing the government.

Police wearing gas masks first broke up a crowd that had gathered in front of a labor union office with the intention of walking to Taksim square. Protesters ran into the building and officers blockaded it, preventing them from leaving.

Police, holding all streets leading to the square, also broke up groups of protesters trying to enter the square through various entrances, firing tear gas and beating some demonstrators with clubs. Some demonstrators threw rocks at police.

Tensions between protesters and police ebbed slowly after unions said they would abandon plans to march to Taksim.

"We could continue to rally there but the damage would be great. We did not want to harm ordinary people and shop owners," said Suleyman Celebi, head of a large confederation of labor unions. "Eventually, we will be there."

People trying to get to work were affected by the tear gas, and could be seen coughing or covering their mouths and noses.

Tear gas wafted through Istanbul's upscale Nisantasi neighborhood, which is lined with luxury shops, where police and protesters also faced off.

A tear gas canister went off at the entrance of the emergency ward of a nearby hospital, affecting patients and staff, private NTV television reported.

Last week, the government agreed to commemorate workers on May Day, but rejected requests for the day to be a public holiday and for festivities to be held at Taksim.

Turkey had stopped marking May 1 as Labor Day after a 1980 military coup, whose leaders regarded the festivities as an opportunity for leftist activism.

Labor unions gradually resumed marking the day after the coup. Some demonstrations turned violent when protesters tried to enter Taksim to commemorate the workers who died in 1977. Last year, hundreds of demonstrators were detained.