Teachers and police clash in Mexico

Police in Mexico City clash with protesters during an operation to clear a square occupied by teachers demonstrating against reforms.

Riot police have swept thousands of striking teachers out of the heart of Mexico City, driving protesters through the streets with tear gas and water cannons in a swift end to the weeks-long protests against education reforms.

Authorities did not immediately report any injuries. Federal police chief Manuel Mondragon said on Friday that more than 20 demonstrators were arrested.

The teachers, who had occupied the Zocalo square for three weeks, had been ordered to vacate the area ahead of the nation's independence day celebrations this weekend.

The protesters used steel grates and plastic traffic dividers to block the streets leading into the Zocalo, home to the Metropolitan Cathedral, Templo Mayor and National Palace, some of the city's best-known tourist attractions.

There was additional pressure to clear the Zocalo where the teachers had been camping out before the president's first traditional Independence Day celebration in the massive colonial-era square on Sunday and Monday.

The confrontation erupted after the teachers armed themselves with metal pipes and blocked off the Zocalo with steel grates and plastic traffic dividers, threatening to scuttle the Independence Day gathering.

The government responded that celebrations, including the president's shout of independence from a balcony of the National Palace overlooking the Zocalo, would take place in the square as scheduled on Sunday night.

It was a dramatic reassertion of state authority after weeks of near-constant disruption in the centre of one of the world's largest cities.

The teachers have marched through the capital at least 15 times over the last two months, decrying President Enrique Pena Nieto's plan to break union control of education with a new system of standardised teacher testing that become law on Tuesday.

The teachers' demonstrations have slowed passage of Pena Nieto's education reform and the pace of his wider agenda of structural reforms, which seeks to reengineer some of Mexico's worst-run institutions, including the weak tax-collection system and underperforming state oil company.

The Mexican president will almost certainly gain significant political capital if the Friday afternoon operation, led by federal instead of city police, definitively ends the demonstrations that have snarled traffic for weeks in Mexico City.

The teachers say blocking the reform itself is no longer the point. They say they are now trying to maintain pressure to protect their rights and privileges as the government puts the labour reforms into effect and reduces union control over teacher hiring and assignment.