A former Maryland state senator pleaded guilty Thursday in federal court to two counts of fraud for accepting $15,300 in bribes.

Nathanial Oaks, a 71-year-old Baltimore Democrat, entered guilty pleas to one count of wire fraud and one count of honest services fraud, hours after he resigned from office. He faces up to 20 years in prison on each of the two counts.

U.S. District Court Judge Richard Bennett said other charges, including obstruction of justice, would be dismissed under a plea deal with prosecutors. The judge scheduled sentencing for July 17. Oaks pleaded guilty to taking the bribes from an FBI informant posing as a Texas investor looking to obtain contracts in Baltimore.

"Yes," Oaks said, when asked by the judge if he had committed the crimes.

Oaks and his attorneys declined to comment as they entered and left the courthouse.

The case arose from an investigation dating to 2015, when Oaks was a member of the Maryland House of Delegates. In the plea agreement, Oaks admitted he issued two letters on his office letterhead in 2016 that contained false and fraudulent representations to a person he believed to be a U.S. Housing and Urban Development official. The letters were sent to help obtain federal grant funds for the FBI informant, who went by the name Mike Henley. Henley paid Oaks $10,300 for his help.

Henley paid Oaks another $5,000 in exchange for Oaks' agreement to file a bond bill request with the Maryland Department of Legislative Services seeking $250,000 in state funds for a development project.

The money paid to Oaks was supplied by the FBI. Meetings between Oaks and the informant were recorded with audio and video recording equipment.

Court records describe Oaks as being careful not to openly talk about payments. During an April 2016 meeting when the two discussed ways Oaks could help, the lawmaker put a lollipop in his mouth. The source then held up five fingers to signify a $5,000 payment. Oaks then shook his head from side to side and made an upward motion with his thumb to indicate a higher amount, court records say. He also used code words with the informant to set bribe amounts. Court records say the informant and Oaks had settled on "lollipop" as a code word for $1,000, stemming from the time he put the Tootsie Pop in his mouth to halt open discussion of monetary amounts.

Oaks confessed to two FBI agents in January 2017 that he accepted the payments, and he agreed to cooperate with the FBI in an investigation of another person. As part of that investigation, Oaks covertly recorded his phone conversations with the person, but in March he tipped off the target of the probe during a meeting in an Annapolis bar and told him: "What we talked about, just say no." Oaks warned the target again later that month in the hallway of a state government building in the state capital.

Because of the tip off, the investigation into the target and possibly other politicians was no longer viable, the U.S. attorney's office said.

Oaks' indictment last year came amid a flurry of state and federal charges against would-be, former and sitting lawmakers who ended up in legal trouble. Gary Brown, a Democrat, was indicted by state prosecutors early last year on charges of making illegal campaign contributions, one day before he was scheduled to be sworn in as a Baltimore delegate. A day later, federal prosecutors announce a former delegate, William Campos, had pleaded guilty to bribery and conspiracy in a public corruption case involving the liquor industry in Prince George's County. And the very next day, just before the legislative session started, another Prince George's County Democrat, Del. Michael Vaughn, abruptly announced his resignation. Vaughn was indicted in the same federal case as Campos.

Oaks represented Baltimore in the House from 1983 until early 1989. In 1988, he was convicted of theft and misconduct in office charges for stealing thousands of dollars from his re-election fund. He received a five-year suspended sentence and lost his House seat as a result. But in 1994, Oaks was re-elected to the House, where he served until last year, when he was appointed to replace a senator who retired.

Oaks, whose indictment became public nearly a year ago, remained in office while he faced the charges. He submitted his resignation letter Wednesday night with an effective date of 9 a.m. Thursday. The Senate president removed him from his position on the Senate Finance Committee last month, at the recommendation of a legislative ethics panel.