Mexico's army says troops have detained a small-town mayor in the company of heavily armed drug cartel gunmen, leaving the ruling party officials scrambling to distance themselves from a man who had run for office on their ticket.

The Defense Department said late Wednesday that soldiers detained Chinameca Mayor Martin Padua on Tuesday along with five alleged members of the Zetas drug cartel carrying rifles and hand grenades.

The town is near the port city of Coatzacoalcos in the Gulf coast state of Veracruz.

Padua is being held pending investigation, but President Felipe Calderon's conservative National Action party rushed to distance itself from him, saying he was not a member of the party even though he ran for office on the ticket of National Action, known as the PAN.

"The PAN condemns the presumed criminal acts of this mayor," the party said in a statement, noting that according to local police, Padua was detained along with a group of drug cartel suspects at a house where the gang had holed up and exchanged gunfire with soldiers.

Mexican electoral law does not generally allow write-in or independent candidates, so politicians have to find a party to sponsor their candidacies; parties with little presence in some states often allow outsiders to run on their tickets.

National Action said "any person who collaborates with criminals should be punished, independently of which party he belongs to or what office he holds."

Calderon has directed a 5 1/2-year-long offensive against drug cartels, and his administration also arrested 12 mayors and 23 other officials in the western state of Michoacan in 2009 for alleged links to drug cartels. All 35 were later acquitted and released.