TANCITARO, Mexico — The Mexican government is facing a crucial test over the coming days as it moves to rein in armed militia groups across the mountain towns of Michoacan, the volatile western state where avocado farmers and lime pickers have banded together to drive out drug cartel gangsters.

While the “self-defense” movement has been celebrated in many corners of Mexico, it has also produced embarrassing images of teenage vigilantes running highway checkpoints and brandishing AK-47s and other weapons that are supposed to be illegal.

The government of President Enrique Pena Nieto began demobilizing the militias this weekend and replacing them with a new force, the Rural Police, whose ranks will be drawn from the vigilantes themselves.

But the government’s demobilization push has also created the potential for new clashes: between Mexican security forces and militiamen, but also among rival militias, including those that have boycotted the process and allege their former comrades are morphing into new, government-sanctioned criminal groups.

Pena Nieto has designated a high-ranking government lawyer from his inner circle, Alfredo Castillo, to manage the pacification plan. On Saturday, Castillo stood before television cameras with the first 240 members of the Rural Police, handing a shiny new assault rifle to Estanislao Beltran, the squat, bearded militia leader known here as “Papa Smurf.”

But as they shook hands, other vigilante groups were refusing to lay down their weapons.

“Everyone is afraid that the government will make a deal and the cartel will come back,” said Eriberto Sanchez, a portly 30-year-old militiaman standing at a roadside bunker of fraying sandbags, a mother-of-pearl-handled Colt .38 pistol tucked in his belt. “We don’t have an honest government.”

If Mexican police and soldiers try to forcibly disarm the militias, “a lot of blood will be spilled,” he said.

The government’s strategy here carries significant risk for Pena Nieto, who has quieted doubts about his crime-fighting mettle in recent months by taking down several top cartel bosses, including Mexico’s most wanted trafficker, Joaquin “El Chapo” Guzman.

But bringing the rule of law to Michoacan, where the federal government has often been absent, or resented, will be nettlesome.

Castillo said the government has taken a flexible, patient approach. But he warned that in towns where the new Rural Police force has been activated, armed militiamen who refuse to stand down will face arrest.

“We want to avoid confrontation,” Castillo said in an interview. “We’re trying to reestablish harmony, order and peace.”

Asked when Michoacan last had those things, Castillo paused. “I don’t know,” he said.

The demobilization plan has produced extraordinary scenes in recent weeks, as Michoacan residents have convened en masse to register their weapons, including high-caliber firearms that have long been illegal for civilians to carry.

Castillo said the military had registered more than 6,000 firearms prior to the weekend deadline, and more than 3,000 applicants had signed up to join the Rural Police – far more than they could initially accept.

The government says it does not plan to expand the registry beyond Michoacan, but Castillo acknowledged it could set a precedent in a country that had some of the hemisphere’s most restrictive gun laws on the books, yet a glut of illegal weapons on the streets.

Many militiamen said they were unconvinced by government assurances that it would not use the new database to take their firearms away.

Only subscribers are eligible to post comments. Please subscribe or to participate in the conversation. Here’s why.

Use the form below to reset your password. When you've submitted your account email, we will send an email with a reset code.