SAN SALVADOR, El Salvador — Former Salvador President Tony Saca pleaded guilty Thursday to embezzling hundreds of millions of dollars in public funds during his 2004-2009 government.

Saca acknowledged to a three-judge panel that he was the brains of a network that prosecutors say diverted $301 million in public funds.

Saca's lawyer Mario Machado said his client had not admitted his guilt before because procedurally it was not the right time.

"I took advantage of the scarce controls on the two accounts" opened by his private secretary to pay other people, Saca said.

He admitted paying $100,000 a month to various publicity firms, including some that provided no services, and those firms gave 80 percent of the money back to him and kept the rest. He said he paid journalist Jorge Hernandez, who had an interview program on one of the country's most important networks, $10,000 per month for favorable coverage of his administration.

Saca also said he gave his wife $10,000 per month to pay off credit card debt. The couple bought a dozen properties through front men and built a luxurious house.

The 53-year-old ex-president was arrested in October 2016. He had faced up to 30 years in prison, but his guilty plea allows for a lighter sentence. Under the plea agreement prosecutors were asking for a 10-year sentence.