WASHINGTON (Reuters) - A Fox News guest terrorism analyst pleaded guilty on Friday to U.S. charges that he fraudulently claimed to have been a CIA agent for decades, federal prosecutors said.

Wayne Simmons, 62, of Annapolis, Maryland, entered the plea in U.S. district court in Alexandria, Virginia, a Washington suburb, the U.S. Attorney’s Office said in a statement.

The plea came in a hearing in which Simmons changed the not-guilty plea he had made in October.

“His fraud cost the government money, could have put American lives at risk, and was an insult to the real men and women of the intelligence community who provide tireless service to this country,” said Dana Boente, the U.S. Attorney for the Eastern District of Virginia.

Simmons had appeared on Fox News, the top-ranked U.S. cable television news network, as an unpaid guest analyst on terrorism since 2002.

A grand jury indicted him in October for portraying himself as an “Outside Paramilitary Special Operations Officer” for the Central Intelligence Agency from 1973 to 2000.

Simmons pleaded guilty to charges of major fraud against the U.S. government, wire fraud and a firearms offense. He faces up to 40 years in prison. Sentencing is set for July 15.

Simmons admitted that he defrauded the government in 2008 when he got work as a team leader in an Army program, and again in 2010 when he was deployed to Afghanistan as an intelligence adviser, the statement said.

He said he made similar false statements in a 2009 bid to get work with the State Department’s Worldwide Protective Service.

Simmons also admitted to defrauding an unidentified woman out of $125,000 in a bogus real estate investment. When he was arrested, Simmons illegally possessed two firearms, which he was barred from having because of prior felonies, including a state conviction and two federal firearms violations.