(This version of the Sept. 14 story corrects to say that Weiner was defeated in the 2013 mayoral election, did not drop out, in last paragraph)

FILE PHOTO: Former U.S. Congressman Anthony Weiner exits U.S. Federal Court, after pleading guilty to one count of sending obscene messages to a minor, ending an investigation into a "sexting" scandal that played a role in last year's U.S. presidential election, in New York City, U.S., May 19, 2017. REUTERS/Brendan McDermid

NEW YORK (Reuters) - Former U.S. congressman Anthony Weiner has asked a judge not to sentence him to prison after he admitted to sending sexually explicit messages to a teenage girl, igniting a “sexting” scandal that played a role in last year’s U.S. presidential election.

In a filing in Manhattan federal court late on Wednesday, Weiner’s lawyers said Weiner acted out of the “depths of an uncontrolled sickness.” They argued Weiner should be sentenced to probation, including mental health treatment, and perform community service.

Weiner, 53, submitted his own letter to the court in which he apologized and said he was continuing to seek treatment.

“I don’t know how I will be able to make amends to the young person who I dragged into my sordid mess,” he said.

Weiner’s wife, Huma Abedin, an aide to former Democratic presidential candidate Hillary Clinton, has filed for divorce. She also submitted a letter to the court asking it to consider the impact of the sentence on the couple’s son.

Weiner pleaded guilty in May to transferring obscene material to a minor. The charge carries a maximum sentence of 10 years, though prosecutors said as part of a plea deal that they would consider a term between 21 and 27 months “fair and appropriate.”

The investigation into Weiner’s exchanges with the teenage girl roiled the 2016 U.S. presidential campaign in its final days, when authorities found emails on Weiner’s laptop from Abedin.

The discovery prompted James Comey, then director of the Federal Bureau of Investigation, to announce in late October that the agency was reviewing the messages to determine whether to reopen its investigation into Clinton’s use of a private email server as U.S. secretary of state.

Clinton has said the announcement contributed to her upset loss to Republican Donald Trump, who had accused her of endangering national security by using the private server.

Comey testified before Congress in May that the emails found on Weiner’s computer included classified information.

Trump fired Comey in May amid the FBI’s probe into whether Trump’s campaign colluded with Russia to defeat Clinton, a claim the president has denied.

Weiner served parts of New York City for 12 years in the U.S. House of Representatives before resigning in 2011, when it emerged that he had exchanged sexually explicit messages with women.

Two years later, he ran for New York City mayor, but was defeated in the Democratic primary after more lewd messages became public.