Ayala, a Texas-based norteno singer, was arrested Dec. 11 when troops raided a lavish party hosted by the Beltran Leyva cartel outside the central mountain town of Tepoztlan. His lawyer has said Ayala and his band, the Bravos del Norte, were hired to play at the party and did not know his clients were drug traffickers.
Cartel chief Arturo Beltran Leyva, who is believed to have fled the party, was killed in a shootout five days later when marines raided an apartment in the city of Cuernavaca.
The Attorney General's Office said in a statement that Ayala was released because of his "critically deteriorating health" but did not specify what his ailment was. The agency said Ayala still faced possible charges of organized crime and taking illicit money.
The rest of Ayala's band members were released last week, but seven musicians from two other groups remain jailed. Eleven suspected cartel members were also arrested in the raid.
Mexican norteno bands often sing about drug trafficking and violence, and many have been rumored to perform at drug traffickers' weddings and other parties, although few have been caught.
It was unclear where Ayala, who lives in Hidalgo, Texas, went after his release. His lawyer, Adolfo Vega, could not be reached for comment.