A former security guard at the construction site of a new U.S. consulate compound in Guangzhou, China pleaded guilty Thursday to trying to sell secret photos and other secret information about restricted areas inside the facility to China's Ministry of State Security.

At a hearing in federal court, Bryan Underwood admitted that the case against him as laid out by prosecutors in court papers was correct.

"Guilty," he said when the judge asked for his plea.

According to prosecutors, Underwood had lost a substantial amount of money in the stock market and hoped to make $3 million to $5 million by selling information and access to the consulate. Underwood created a schematic that listed all security upgrades to the U.S. consulate and drew a diagram of the surveillance camera locations at the facility, according to papers in the case.

Underwood wrote a letter to the ministry of state security expressing interest in initiating a business arrangement with Chinese officials and took photographs of his worksite to pass on. He was turned away by a guard who declined to accept the letter.

He later left the letter in the open in his apartment hoping that Chinese state security would find it. He believed that Chinese state security routinely searched apartments occupied by Americans.

A year ago, U.S. law enforcement agents in Hong Kong interviewed Underwood and he revealed his plans to sell information and access to China.

The charge Underwood pleaded guilty to carries a sentence of up to life in prison. Under federal sentencing guidelines, Underwood likely will be sentenced to serve between 188 and 235 months in prison. That's between 15 and 20 years.