LOWER MANHATTAN (WABC) -- Disgraced former U.S. Rep. Anthony Weiner has pleaded guilty to transmitting sexual material to a minor and could get years in prison.He tearfully admitted to a federal judge that he sent obscene material to a high school student in North Carolina he knew to be 15.Weiner agreed Friday not to appeal any sentence between 21 and 27 months in prison. The federal charge to which Weiner pleaded comes with a sentence of zero to 10 years. He signed a plea agreement with prosecutors in which he agreed not to appeal any sentence between 21 and 27 months in prison. His lawyer can request leniency at a sentencing scheduled for Sept. 8.Weiner agreed to surrender his iPhone as part of the plea agreement. The judge also told him he would have to register as a sex offender.He is released on $150,000 and is scheduled to be sentenced Sept. 8.Wearing his wedding ring and a dark blue suit with a maroon tie, Weiner read from a prepared statement after U.S. District Judge Loretta A. Preska addressed him: "Tell me what you did, sir."He said he "compulsively sought attention from women who contacted me on social media" beginning with his service in Congress and continuing through the first half of last year."I engaged with many of them in both sexual and nonsexual conversation," he said. "These destructive impulses brought great devastation to my family and friends and destroyed my life's dream in public service. Yet I remained in denial even as the world around me fell apart."It was an emotional and halting allocution, and Weiner took frequent pauses for water. He said he knew his conduct was "as morally wrong as it was unlawful."Weiner's brother was the only family in court to watch as he said he "hit bottom" and began therapy. "I have a sickness," he said, "but I do not have an excuse."He apologized to "everyone I have hurt," including the girl he "mistreated so badly."Finished speaking, he wiped his eyes with tissues. The hearing lasted less than a half hour. Afterward, he shook hands with prosecutors, telling them: "Thanks, guys. I appreciate your service."Acting Manhattan U.S. Attorney Joon H. Kim called Weiner's actions "not only reprehensible, but a federal crime, one for which he is now convicted and will be sentenced."Weiner turned himself in to the FBI Friday morning and was at federal court at 500 Pearl St., in Manhattan for the arraignment.Attorney Arlo Devlin-Brown said his client had "made a commitment to make amends." The offense "did not feature aggravating factors often present in cases of this kind."The FBI began investigating the Democrat in September after a 15-year-old North Carolina girl told a tabloid news site that she and the disgraced former politician had exchanged lewd messages for several months. She also accused him of asking her to undress on camera.The investigation of his laptop led to the discovery of a cache of emails from Democratic presidential nominee Hillary Clinton to her aide Huma Abedin, Weiner's wife.The two investigations - into Weiner and into Clinton's use of a private email server - briefly collided and caused then-FBI Director James Comey to publicly reveal agents had reopened the Clinton case days before the election.Weiner's online behavior first cost him his career in Congress, but he was on the verge of a comeback win in the Democratic primary for NYC mayor when his continued sexting was revealed despite earlier pledges he had overcome the compulsion.