efe-epaNew York

A controversial former US congressman was found guilty Friday of sexting obscene messages to a minor, officials said.

Anthony Weiner, 52, whose political career came crashing to an end amid numerous sex scandals, had been under investigation for more than a year for allegedly exchanging lewd messages and photos with a 15-year-old girl.

The US attorney for the Federal District Court in Lower Manhattan said Weiner turned himself in early Friday morning to the New York office of the Federal Bureau of Investigation (FBI) and was found guilty hours later after appearing before US District Judge Judge Loretta A. Preska.

He was freed on bail to await sentencing, which will be announced next Sept. 8.

In its probe, the FBI discovered thousands of e-mails on his computer from Hillary Clinton, which led to the reopening in October of the investigation of the then-Democratic candidate for the White House, something that could have cost her the presidency.

The messages were on a laptop computer that Weiner shared with Clinton's assistant Huma Abedin, with whom Weiner had been married until the year before.

The maximum penalty facing the former congressman is 10 years behind bars. As part of the agreement with the US attorney, Weiner has agreed not to appeal a decision of the court if it sentences him to no more than 27 months in prison.

The judge told Weiner he will have to register as a sex offender.

When informed of the decision, acting US attorney for the Southern District of New York, Joon H. Kim, said that "Weiner's conduct was not only reprehensible, but a federal crime, one for which he is now convicted and will be sentenced."

The investigation came to light last September after the UK newspaper The Daily Mail reported that for months Weiner had exchanged messages of explicitly sexual content with a minor.

Previously, in 2011, he had to leave his seat in Congress when he was discovered sexting a number of women on the Internet.

In 2013, that same behavior trashed his hopes of becoming mayor of New York, and last year The New York Post reported yet more pornographic messages and photos that Weiner had supposedly exchanged with a woman since early 2015.

After that scandal, Abedin - who had a son with him - announced her decision to end their marriage.

Weiner was a congressman between 1999 and 2011, representing a New York district. He was then considered one of the rising stars of the Democratic Party.