Police in Spain said they have foiled a potential gas attack on a group of anti-Pope protesters at a Catholic youth festival in Madrid.

A Mexican organic chemistry student has been arrested in connection with the plot. Police said the suspect was conspiring to attack the demonstrators "asphyxiating gases and other chemical substances.”

Police who searched the suspect’s apartment found an external hard-drive and notebooks with chemical equations not connected to his studies, as well as a computer "allegedly used to recruit on the internet.”

According to the El Pais newspaper, police were alerted to the suspect by people who went online and saw inflammatory remarks he made on web forums.

The suspect’s name was not released by police.

A six-day Catholic youth festival in Madrid is expected to draw at least 1-million people from around the world, highlighted by a visit on Thursday by Pope Benedict XVI.

Some Spaniards are unhappy about the Pope’s trip – both from a financial perspective, given the enormous security costs a papal visit entails amidst the country’s ongoing economic crisis; others are planning to protest the Pope’s views on abortion and homosexuality.

More than 100 Spanish groups plan to protest the Pope’s visit on Wednesday evening.

"We are not angry about the Pope's visit, which some will agree with and others won't, but rather over the financing of it with public money, especially at a time when many services are being cut because it's necessary to curb government spending," a protest group said in a statement.

However, organizers of the Catholic youth festival claim the event will raise about 100-million euros ($144-million) "at zero cost to taxpayers".