NEW YORK — Former U.S. Rep. Anthony Weiner has been ordered to register as a sex offender as he nears the end of a 21-month prison sentence for having illicit online contact with a 15-year-old girl.

A New York City judge on Friday designated Weiner a Level 1 sex offender, meaning he's thought to have a low risk of reoffending.

Weiner must register for a minimum of 20 years. He's required to verify his address every year and visit a police station every three years to have a new picture taken.

Get Breaking News Delivered to Your Inbox

Weiner didn't attend Friday's court hearing. He's in a halfway house after serving most of his sentence at a prison in Massachusetts. He's due to be released May 14.

Before being sentenced, the Democrat said he'd been a "very sick man."

"These destructive impulses brought great devastation to my family and friends, and destroyed my life's dream of public service," Weiner said when he pleaded guilty in 2017. "I am committed to making amends to all those I have harmed."

The disgraced former congressman acknowledged he communicated online with a girl who accused him of sending sexually explicit messages, but said he's also been the subject of a hoax.

Weiner's reputation grew because of his marriage to Huma Abedin, a top aide to Hillary Clinton. It was because of content found on Weiner's laptop, the FBI said, that encouraged the FBI to re-open the investigation into Clinton's emails, something then-FBI Director James Comey announced only days before the 2016 presidential election.