Clinton book has sold more than 300,000 copies
Weiner's lawyer, Arlo Devlin-Brown, said that while Weiner exchanged sexually explicit messages with many women, all of the others were adults, and noted the teenage girl contacted Weiner first.
Cote said she believed Weiner was suffering from an addiction, and was serious about being treated. However, she said it was important to deter others from committing similar crimes.
"There is the opportunity to make a statement that could protect other minors," she said.
Weiner declined to speak to reporters as he left the courtroom. He was ordered to surrender by Nov. 6.
The investigation into Weiner’s exchanges with a North Carolina high school student roiled the 2016 U.S. presidential campaign in its final days, when authorities found emails on Weiner’s laptop from his wife Huma Abedin, an aide to Democratic presidential candidate Hillary Clinton.
Abedin has filed for divorce. Weiner, who wore his wedding band at the sentencing, and Abedin have a son, Jordan, who is 5 years old.
The discovery of the emails prompted James Comey, then director of the Federal Bureau of Investigation, to announce in late October that the agency was reopening its investigation into Clinton’s use of a private email server while she was 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.
President Trump fired Comey in May amid the FBI’s probe into whether his campaign colluded with Russia to defeat Clinton, a claim the president has denied.
Weiner represented parts of New York City in the U.S. House of Representatives for 12 years before resigning in 2011, after it emerged that he had exchanged sexually explicit messages with adult women.
In 2013, Weiner ran for New York City mayor, but dropped out of the race when more lewd messages became public.
(Reporting by Brendan Pierson in New York; Editing by Diane Craft and Jeffrey Benkoe)