PROVIDENCE, R.I. (AP) — A former state lawmaker acknowledged he lied to investigators about his residency as part of a plea deal with the state, prosecutors announced Wednesday.

Attorney General Peter Kilmartin said that former state Rep. John Carnevale pleaded no contest to a felony charge of perjury in Providence.

That means Carnevale is no longer eligible to try to recapture his old seat this year. Carnevale, a Democrat, was endorsed by local Democrats in the race for House District 13 over the incumbent, Democratic Rep. Ramon Perez.

Carnevale's name will be removed from the primary ballot, according to the secretary of state's office.

Carnevale was indicted last year after a WPRI-TV investigation raised questions about whether he lived in the district he represented, revealing that Carnevale spent much of his time at a different home he owned in Johnston, Rhode Island. Providence elected officials kicked Carnevale off the voter rolls and he dropped his 2016 re-election campaign.

Attorney William Dimitri told WPRI on Wednesday that Carnevale weighed the risks of going to trial.

Prosecutors will dismiss two other counts of perjury and one count of filing a false document.

Kilmartin said that had the case proceeded to trial, the state was prepared to prove that Carnevale perjured himself when he lied under oath three times to the Providence Board of Canvassers during a July 2016 hearing about whether he lived at the multifamily home in Providence where he was registered to vote.

Carnevale is sentenced to five years, with nine months to serve on home confinement and the remainder suspended with probation. The sentence will be imposed Aug. 22 as long as the state confirms Carnevale is eligible for home confinement, Kilmartin added.

Carnevale is a retired police officer and former vice chair of the powerful House Finance Committee. Under state law, he cannot seek political office until three years after the end of his sentence.