A federal judge dismissed weapons charges against a flamboyant gambling magnate-turned-politician on Tuesday, dealing a stinging setback to President Felipe Calderon's battle against organized crime and fueling claims that a pre-dawn military raid on the former mayor's compound was an attempt to damage his party ahead of Mexico's presidential elections.

But Jorge Hank Rhon did not go free as he left the federal prison. He is being held for investigation of ordering the 2009 murder of Tijuana woman, the Baja California state prosecutor said in a press conference Tuesday afternoon.

State officials immediately took the 55-year-old gambling magnate into custody earlier in the day.

State Attorney General Rommel Moreno said the assassin has testified that he killed 24-year-old Angelica Munoz in her apartment in August 2009 under orders from Hank Rhon.

The judge has until early Thursday to approve the detention order to hold him 40 days without charges while prosecutors complete the investigation, Attorney General spokesman Marco Vinicio Blanco said.

Dismissal of the federal charges followed 10 days of increasing questions about the arrest. Hank Rhon's lawyers said raid was illegal because soldiers didn't have a search warrant. Supporters demonstrated in the streets for his freedom. Catholic bishops joined calls for his speedy release.

"If they were going to make a political strike on this scale, why didn't they do it right?" said Jose Antonio Crespo, a political analyst at Mexico City's Center for Investigation and Economic Research. "They didn't lack evidence; they just needed to follow procedures and do things right."

Judge Blanca Evelia Parra Meza ruled there wasn't enough evidence to order Hank Rhon and eight others to stand trial on charges of possessing weapons restricted to military use, according to a statement from the court office. It did not elaborate on the reasons. The federal attorney general's office, which has insisted soldiers didn't need a search warrant, promised to appeal.

Hank Rhon was Tijuana's mayor from 2004 to 2007, when he staged a failed run for governor. He has long figured large on the national political scene, and not only because of the wealth amassed from his Caliente gambling empire.

His father was one of Mexico's best-known politicians, leader of faction in the Institutional Revolutionary Party that ruled Mexico from 1929 until 2000. National polls indicate that the man with the best chance to oust Calderon's National Action Party and recover the presidency in 2012 is Enrique Pena Nieto, who hails from that faction and has political ties to Hank Rhon.

The seeming collapse of the case echoed a 2009 strike against mayors from Calderon's home state of Michoacan, most of them from opposition parties, who were accused of protecting drug traffickers and were eventually released for lack of evidence.

David Shirk, director of the University of San Diego Trans-Border Institute, said it would be a "huge embarrassment" if Hank Rhon is cleared.

"It's not so much that they made a mistake. It's that they have not been able to convict a noticeable number of organized crime suspects," he said.

Plans for a celebration at Hank's Rhon's sprawling compound -- which includes a casino, racetrack and private zoo -- were put on hold after he was shuttled from prison in the border city of Tecate to a Tijuana office of the state attorney general.

Mexican law allows suspects to be held for up to 40 days without charges.

Garcia, the human rights ombudsman, said he didn't have details about the case that led state authorities to detain Hank Rhon, but the state prosecutor has said two guns seized in the June 4 raid were linked to the Tijuana killings of a security guard in December 2009 and an alleged car thief in June 2010.

U.S. authorities have long suspected Hank Rhon of links to money laundering, but no accusations have been substantiated and he has strenuously denied ties to drug cartels. Two of his bodyguards were convicted of killing investigative journalist Hector Felix Miranda in 1988, but they denied the attack was linked to their boss, and no charges were filed against him.

Many Mexicans suspected that the army raid was partly motivated by politics.

Political commentator Salvador Garcia Soto wrote in Mexico City's El Universal newspaper Tuesday that the arrest fits into Calderon's desire to portray Pena Nieto's party as part of Mexico's dirty past of one-party rule.

"They showed that they will use all the legal, judicial tools at their disposal," he wrote.

Institutional Revolutionary Party spokesman David Penchyna, a congressman, said his party was closely watching the case and "it would be very bad for the democratic system if the judicial system were used for electoral purposes."

Meanwhile, on the other end of the country, a judge ordered former Chiapas Gov. Pablo Salazar Mendiguchia to stand trial on charges of embezzlement, abuse of authority and criminal association. State prosecutors say he misappropriated funds for hurricane victims. He denies guilt and his backers argue he is the victim of a political vendetta by the current governor there.

In Tijuana, support poured in for Hank Rhon from across the social spectrum.

Tijuana Archbishop Rafael Romo sent Hank Rhon a letter published Monday in Mexican newspapers, saying "I have confidence in God that everything will be conducted in accordance with the law and you will soon be back with your family and us again."

Bishop Oneisimo Cepeda in Hank Rhon's home State of Mexico said the former mayor's troubles have only reinforced their friendship also praised him for his charity.

Virginia Mora, 66, offered an example. She met Hank Rhon in her hardscrabble neighborhood when he campaigned for mayor and stopped by for two servings of homemade soup. He paid her with a huge delivery of cement and other building materials.

"He likes to help people out, give gifts," said Mora, 66.

Bertha Guadalupe Diaz, a 66-year-old street vendor who regularly attends Hank's massive, free parties on Mother's Day and other holidays, recalled being summoned to City Hall when Hank Rhon learned she couldn't afford a hearing aid. He offered to pay the bill.

"Thanks to him, I hear," she said.