Madrid (CNN) -- Spanish police arrested Tuesday a man studying chemistry in Madrid on suspicion he was planning an attack against a march set to protest the high cost of the visit of Pope Benedict XVI to the Spanish capital starting Thursday, the police said.

The suspect "planned to attack using noxious gases and other chemical substances," the national police said in a statement.

The alleged target was a protest march set for Wednesday evening in Madrid, on the eve of the pope's four-day visit.

The police statement said the suspect was studying general organic chemistry at Spain's government-backed Higher Council for Scientific Investigations.

At his home in the upscale Salamanca neighborhood of the capital, police seized a laptop computer, a portable memory device and two notebooks with notes about chemical procedures which were not related to his official studies, the statement said.

The suspect also allegedly was trying to recruit adherents through the Internet. The police statement said citizen collaboration helped lead police to the man.

The cost of the pope's visit to Spain, suffering a deep economic crisis with nearly 21% unemployment, has been top news here in recent days.

Benedict XVI is coming to World Youth Day, a weeklong series of religious events that the Roman Catholic Church organizes every three years, last held in Sydney, Australia.

Organizers expect at least a million youth for the event and Madrid's streets already are filled with many thousands of young Catholics from around the globe, carrying their national flags.

Organizers say the $70 million cost is totally paid by the young people and corporate sponsors -- with no cost to the taxpayer. But others in Spain say there are substantial hidden public costs, including the 10,000 police officers on duty for security, the use of a military air base for Mass, and a discount for visiting Catholic youth on the city's metro, at the same time as regular metro fares have risen sharply.

Critics including Spanish groups called Christian Networks, Lay Europe and a third run by atheists convened a protest march over the costs on Wednesday, and they said they expect up to 10,000 people. The suspect is in custody for allegedly planning to disrupt it.