Anthony Weiner

Former Democratic Congressman Anthony Weiner has pleaded guilty to sexting a 15-year-old girl when he appears in court Friday, according to The New York Times.

The FBI’s investigation into Weiner began after the girl he was allegedly in contact with told British tabloid The Daily Mail that she and Weiner had been exchanging explicit messages for “several months,” and that he’d also allegedly asked her to undress on camera.

Weiner’s plea is said to be part of an agreement with the United States attorney’s office in Manhattan, linked to an investigation that began in Jan. 2016 over allegations that Weiner exchanged sexually explicit texts with a minor in North Carolina.

While his sentence is still to be determined, Weiner could be given up to ten years in prison and may be required to register as a sex offender.

During that investigation, the FBI seized Weiner’s electronic devices. It found a large number of emails to his estranged wife, Hillary Clinton aide Huma Abedin, which led to the surprise renewal of the investigation into Clinton’s private email server just days before the 2016 presidential election.

Michael Moore producing Trump documentary titled 'Fahrenheit 11/9'

Many Democrats, including Clinton, have said the timing of the announcement that the investigation had been renewed contributed to her November loss.

Weiner ran for mayor of New York City in 2013, but lost badly in the Democratic primary after it was revealed that he had exchanged explicit messages with more women after he resigned from Congress.

Abedin and Weiner announced they were separating in August.