CHARLOTTE, N.C. (AP) — A federal judge on Wednesday accepted the guilty plea of a longtime North Carolina state lawmaker who acknowledged conducting a scheme to funnel campaign dollars to his ailing farm.

David Lewis, 49, who until last week was a chairman of the powerful House Rules Committee, appeared before U.S. Magistrate Judge David Cayer to carry out the plea he reached with federal prosecutors.

Lewis, a Harnett County Republican, pleaded guilty to making false statements to a bank — a felony — and for failing to file a 2018 federal tax return, the U.S. Attorney’s Office said in a news release. He will be sentenced at a later date, but prosecutors have said they will not seek active prison time.

Lewis, who was first elected to the House in 2002, became a major player at the legislature as Republicans took control of the chamber in 2011. He became a top lieutenant to House Speaker Tim Moore and controlled the flow of legislation while rules chairman.

Lewis was a chief legislative author of Republican redistricting plans that courts later declared were unlawful gerrymanders. One lawsuit involving the state congressional map that went to the U.S. Supreme Court pivoted on Lewis’ public comments about the districts favoring Republican candidates.

In a document detailing what led to the charges, U.S. attorneys wrote that Lewis opened a bank account in summer 2018 for a fictitious entity whose title appeared similar to the state Republican Party. In turn, Lewis took checks totaling $65,000 coming from his campaign coffers and put them in that account. The money was then used by Lewis Farms and to pay the rent on his home, the document says. The state GOP is not associated with the entity Lewis used to disguise the transfers.

Earlier in the year, Lewis made about $300,000 in transfers from his campaign account to his bank account for his farm, according to the document. Lewis had said his farming business had been struggling for several years. The government said Lewis ultimately reimbursed his campaign for what he transferred and ultimately sent $65,000 to the state party, in keeping with what the campaign reported in reports.

It’s unclear if Lewis, who resigned from his House seat last week just before the charges became public, faces a state campaign finance investigation. He had already announced last month he would not seek reelection in November.