Hundreds of thousands of computers will simultaneously lose access to the internet on 9 July, unless their owners check for a virus that may have remained hidden for several years, the FBI has warned.

The so-called "internet doomsday" will come when the bureau turns off a server system its investigators installed in November, when they broke up an Estonian crime ring that was running a global internet advertising scam.

Since 2007, the six men had been using a Trojan to seize control of computers from all over the world. Their malware was able to take over PCs and Apple products, though iPhones and iPads were not affected.

The virus, called DNS Changer, would redirected the web browsers of victims from sites they wanted to visit to ones controlled by the gang. Revenue from adverts tied to those sites earned the criminals an estimated $14m (£9.1m) in commission. The only noticeable effects of the virus were a slight slowing of internet service, an increase in pop-up adverts, and the anti-virus software having been disabled. By late last year, when the FBI and Estonian authorities shut down the racket, the virus had seized control of about half a million computers.

However, had the investigators simply closed down the gang's servers, every computer infected would have been unable to access the internet.

"If we just pulled the plug on their criminal infrastructure, the victims of this were going to be without internet service," Tom Grasso, an FBI supervisory special agent, told Fox News.

As a result, the FBI created a safety net which would allow infected computers to remain online.

It replaced the gang's servers with a surrogate server system, and set up a free online "DNS Checker Page" which allows people to check if they are victims of the virus, and then remove it from their machine.

Thanks to both measures, the number of computers infected has fallen. But a little over 350,000 remain, according to FBI estimates. About 85,000 are in the US, and 20,000 are in the UK. Most are now believed to be in the hands of private individuals, not corporations.

But running the servers that keeps the surrogate system working costs tens of thousands of dollars, and the FBI is anxious to close them down.