MEXICO CITY — They have seized public plazas and filled them with sprawling tent cities. They have burned government buildings and choked off a city’s gasoline supply. They have held marches and torched ballots and closed schools for weeks at a time.

Mexico’s rowdy public school teachers’ union — particularly the branch based in the southern state of Oaxaca — has long been a thorn in the government’s side, as it wages its battle against President Enrique Peña Nieto’s restructuring of the education system.

But now that last month’s midterm election has passed, and the teachers’ threats of an election boycott largely failed, Peña Nieto’s administration wants to strike harder at the union by sapping its funding and wresting control back into the hands of the state, according to Mexican officials.

The showdown focuses on whether the members of the union’s militant offshoot, with 80,000 members, will submit to standardized tests intended to assess knowledge of subject areas. The wider union, the National Education Workers Union, with more than 300,000 members, is the largest trade federation in Latin America.

Merit testing for teachers is required under the 2013 constitutional overhauls pushed by Peña Nieto’s administration, and the tests have begun for teachers seeking promotions to administrative posts. The education minister, Emilio Chuayffet Chemor, has said that teachers who don’t take the test will be fired.

But teachers are resisting in other areas, particularly in Oaxaca, the home of Section 22, a part of the militant movement within the union, and one of the most vocal local chapters. Oaxaca is one of the poorest states in the country, and government officials say the union there controls the education budget, decides which teachers get paid and promoted, and blocks government school programs they disagree with. Access to vacation days or better jobs can depend on participation in union activities and protests.

The union in Oaxaca “has the power of the state without the corresponding obligations,” said a federal government briefing paper on the problems there.

Mexican officials say they have lost control of the State Institute of Public Education of Oaxaca (IEEPO), which they say is under full control of Section 22. The officials, who spoke on the condition of anonymity, would not discuss how they intend to take back governmental authority. Section 22 leaders did not respond to attempts to reach them.

“The government needs to limit its functions,” Francisco Gil Villegas, a professor of social sciences at the College of Mexico, said of the union. “It’s not clear who is the boss of the teachers, who pays them, who punishes them for wrongdoing. Who’s going to make them fulfill their work obligations?”

The conflict between Oaxacan teachers and the government dates back about a decade. In 2006, soldiers and police mobilized to drive out striking teachers from the central plaza who had camped there for months demanding pay raises. Between 2006 and 2010, the teachers missed an average of 64 school days per year due to strikes and walkouts, according to government statistics. Since the teacher-testing plan passed, teachers have again staged massive protests and canceled classes for weeks at a time.

Created in 1979 by teachers upset with the national union, the militant wing, known as the National Coordinator of Educational Workers (CNTE), is based mostly in the southern states and has taken a stronger stance in opposition to the new testing program.

“The education reform is not about teaching the kids. It’s an administrative labor reform,” said Jose Palacios, a 45-year-old primary-school teacher from Michoacán, who sat outside his blue tent in the plaza next to Mexico City’s National Museum of the Revolution, where he had camped in protest for the past four days. “They want a massive departure of teachers across the country through this punitive test.”

Palacios, who has taught classes for two decades, has been a veteran of many protests and marches and says his movement has more energy now than any time in the past. He considers the union as a defense against budget cuts and a way to preserve his position in changing times. The banners that hang among the tents have slogans such as “Tired of surviving, we want to live” and “Against the bourgeois reforms of the Mexican state.”

“We’re here for job security,” he said. “That’s what we’re fighting for.”

During the run-up to the election, the Oaxacan teachers vowed to prevent the election from taking place. They seized several state electoral offices, cordoned off the airport, cut off the supply of gas to stations across the capital and demanded an election boycott from their thousands of followers. More than 10,000 soldiers were deployed to the state to protect voting booths.

The fears of wider vandalism or violence pressured the government to agree to halt the tests for teachers, offering enough political compromise to sap the protest momentum. On election day, people rallied and torched some ballots, international observers canceled missions for fear of violence, but the vote proceeded relatively smoothly. The next day, Peña Nieto’s government reinstated the teachers’ testing and vowed to push ahead with their overhauls.

Testing is happening across the country except in the states of Oaxaca, Michoacán and parts of Chiapas, according to education officials.

As a way out of the impasse, some suggest the tests should be tailored to accommodate varying education levels among teachers in poor, rural areas.

“The test has become something threatening for the teachers, and so they are threatening the government,” said Alberto Aziz Nassif, a researcher at the Center for Research and Advanced Studies of Social Anthropology in Mexico City. “The government wants to respond, but they don’t know how to respond, so everything remains locked in negotiation.”

As Palacios, the protester in the tent city, put it: “We don’t know how long we’ll be here. That all depends on the government.”