Updated

A Spanish judge ordered the release Thursday of a young Mexican chemistry student arrested on suspicion of plotting a gas attack on protesters opposed to a visit here by Pope Benedict XVI, but the suspect remains under investigation.

Judge Fernando Andreu of the National Court did not immediately bring formal charges against Jose Perez Bautista, but seized his passport and ordered him to report to a police station twice a day.

Andreu announced his order after questioning Perez Bautista for about two hours and just as the Pope arrived for a youth festival. The pontiff is to leave Sunday.

An anti-pope demonstration was held Wednesday night in Madrid. Police had arrested the Mexican on Tuesday because of threats he made on the Internet against anti-pope demonstrators due to take part in that rally.

There was no chemical attack at it, although riot police clashed with demonstrators after it was over. Eight protesters were arrested and 11 people were hurt, including two police.

More On This...

Perez Bautista, a stocky man of 24 with black hair worn in a crew cut, was handcuffed Thursday as two police led him into the office of Andreu for questioning. He wore black jeans and a black T-shirt with a white logo that appeared to be a Pac-Man with teeth.

The Mexican, from Puebla state near Mexico City, is in Spain studying at the government's top research body, the Spanish National Research Council.

Andreu said that a week ago police had traced threatening comments sent to an online daily to a Council IP address and then eventually to the Mexican.

In those messages, Perez Bautista allegedly made disparaging remarks about gays and said it "my struggle" to kill them and "any anti-human aberration during their protests against the Catholic Church," the judge wrote.

Perez Bautista allegedly said he had access to acid and other chemicals to make Molotov cocktails he would throw at protesters, and tried to recruit people to join him.

But the suspect's government-appointed attorney, Antonio Ortiz, said police had not seized any chemicals from his client and that Perez Bautista told the judge he never meant to stage an attack. Ortiz likened the Mexican's online messages to "a joke in bad taste."

"But in the end it was pure fantasy," Ortiz said.

Judge Andreu wrote that the suspect remains under investigation for the possible crime of making violent threats.