ISTANBUL — Riot police officers used tear gas and water cannons to disperse hundreds of protesters who took to the streets of Istanbul on Friday, defying a government ban on May Day celebrations in Taksim Square.

At least 250 people were detained, according to the Istanbul Bar Association.

The authorities had tried to lock down the city by erecting roadblocks and suspending service on the main public transportation lines. About 10,000 police officers were deployed to stop labor unions and activists from gathering in Taksim Square, where violence has marred May Day celebrations in the past.

In the Besiktas district, activists shouted resistance slogans and May Day chants. Many protesters were stopped and searched by the police, and several people carrying gas masks were arrested in the Sisli district.

“Turkey has a highly oppressive government with dictatorial tendencies,” said Kani Beko, the president of the Confederation of Progressive Trade Unions of Turkey, which represents more than 320,000 workers in the country. “They would do anything to prevent anyone calling for better democracy in this country,” he added.