Spanish police have arrested a man suspected of creating a Trojan capable of making secret recordings of Internet users through their webcams and stealing confidential information.

Spanish Civil Guard units caught the computer programmer, identified only by the initials J.A.S, spying on various Net users through their webcams when they surprised him in his home on Monday.

The man is alleged to have created a Trojan horse program distributed through peer-to-peer file sharing networks, like Kazaa. The Trojan horse could be hidden in a file, and once downloaded gave the hacker remote access to the victim's computer.

The Trojan installed a keystroke logger that recorded confidential information such as banking passwords, as well as accessing personal photos and other sensitive information stored on a victim’s PC. It also gave the hacker the ability to operate a webcam connected to the computer, and to view and record anything in the camera's field of vision.

Police characterised the Trojan as "highly sophisticated" and said they believed it had already infected thousands of computers in several countries. As far as they knew, no commercial anti-virus products were able to detect it, they said.

Because they have not identified which Trojan horse the suspect allegedly created, anti-virus companies could not say definitively whether or not they were able to detect it, explained Graham Cluley, senior technology consultant for Sophos.

That said, since the Trojan horse appears to have been around for a while, he suspects that it has been seen by anti-virus companies before. It's now up to the police to share whatever information they have so users could check to see if they were infected, Cluley said.

Spanish police were made aware of the Trojan horse in July when a resident in the city of Alicante contacted the Civil Guard through its Web site to report a computer problem, police said. They then launched Operation Tic-Tac, and by working with a Spanish anti-virus company they were able to locate the suspect, they said.

In addition to catching him in the act of spying, police found abundant documents, recordings and other incriminating material in his home, they said.

"We believe he is guilty. We found a mountain of evidence," a spokesman for the Civil Guard said Wednesday. The suspect is due to appear in court later Wednesday. If convicted, he could face years in jail, the spokesman said.