Vigilante forces trying to defend against drug violence paused their convoy on Friday after hearing rumors of an ambush. Alan Ortega/Reuters

MEXICO CITY — Mexican soldiers met fierce resistance on Tuesday as they began disarming vigilante groups that have been fighting drug gangs in the agricultural lowlands of the western state of Michoacán.

In a fluid conflict that is emerging as the first major security test of President Enrique Peña Nieto’s 13-month presidency, the government sent police and army convoys across the western state to restore order in the region, known as the Tierra Caliente, or the hot country.

But as tanks and trucks entered small towns where the vigilantes had taken control in the past few days, soldiers who tried to confiscate weapons found themselves surrounded by shouting townspeople rallying behind the self-defense forces.

Spokesmen for the groups said Tuesday that they would not give up their weapons until the government arrested the top leaders of the Knights Templar, the drug ring that controls parts of the state and that has branched out into extortion and kidnapping.

“The only thing we are doing is defending our family, defending our villages,” Estanislao Beltrán, a spokesman for the self-defense groups, told a radio interviewer on Tuesday. “We are working people, we are farmers. The government hasn’t been concerned for 11 years over maintaining the security of our people.”

Self-defense groups said four civilians were killed in the village of Antúnez when soldiers were confronted by a large crowd.   The government confirmed one death.

José Luis Moreno Ceja, the planning director for the town of Parácuaro, where the self-defense groups took control on Saturday, said that the community supported the vigilantes. The army had yet to enter the town when he spoke. “We are all afraid, precisely because the government has failed to protect us for so many years,” he said in a telephone interview.

He added that the people of Parácuaro would not allow the government to disarm the self-defense forces, whom he described as “people who did not have to do what they are doing, sacrificing their lives in order to free us from the Templars’ will.”

The vigilantes’ heavy guns and trucks have raised suspicions that they may be allied or supported by a drug gang that is a rival to the Knights Templar, but the self-defense groups’ leaders have repeatedly denied that.

The government’s policy was intended to curb all armed groups in the state, but the soldiers’ actions seemed directed at the self-defense forces alone, except in Apatzingán, the stronghold of the Knights Templar, where soldiers and the police surrounded City Hall.

Since the self-defense groups gathered force in several states besieged by drug violence at the beginning of last year, the government’s policy has been confused. At first, officials said the groups were illegal, and Mr. Peña Nieto ordered soldiers into Michoacán last May. Then, as the groups appeared to be effective in challenging the Knights Templar, the government seemed to tolerate them.

But in the past week, as the self-defense forces took control of towns across the region and declared that their next target was to evict the Knights Templar from Apatzingán, the government appeared to change course.

Alejandro Hope, a security analyst with the Mexican Institute for Competitiveness in the capital, said: “The policy of the federal government vis-à-vis the self-defense groups — let me put it gently — has been a work in progress. I’m not sure what the thinking is. My guess is that they’re reactive.”

He warned that the government now found itself in a Catch-22. If soldiers continue to disarm the self-defense groups, the government will be accused of being complicit with the Knights Templar, but if it stops it will be accused of protecting paramilitary groups.

Eduardo Guerrero, a security analyst in Mexico City, said the government had no choice but to intervene because “the Knights Templar would have massacred a great number of the self-defense forces” in a battle over Apatzingán.

But disarming the vigilantes completely would leave communities at risk and seem to send the message that the government is supporting the Knights Templar. “The government has to act according to priorities, and the priority is the Knights Templar,” Mr. Guerrero said.