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.