Anthony Weiner, whose career as a congressman collapsed after he posted sexually suggestive pictures of himself on Twitter, has announced that he’s running for mayor of New York City.

After months of speculation, the former congressman announced via a YouTube video that he will be running for mayor of New York City, nearly two years after he resigned from Congress over a sexting scandal. NBC's Mara Schiavocampo reports.

“I made some big mistakes and I know I let a lot of people down. But I've also learned some tough lessons,” the Democrat said in a video posted on his website late on Tuesday.

"I'm running for mayor because I've been fighting for the middle class and those struggling to make it my entire life," he added. “I hope I get a second chance to work for you."

The video, which features his son and wife Huma Abedin, an aide to former Secretary of State Hillary Rodham Clinton, focused on his middle-class roots in Brooklyn.

With this bold attempt at a comeback ahead of the primary in September, Weiner is hoping to erase the image of a tweeted crotch shot that precipitated his resignation.

He at first claimed that his Twitter account had been hacked after a photo of an underwear-clad groin appeared on his feed in 2011. But when more pictures came out, the congressman admitted he had exchanged risqué messages with a number of women and soon resigned.

Prior to his 2011 unraveling, Weiner had begun to plan for a 2013 campaign, NBCNewYork.com reported, and he still has more than $4 million in his campaign account.

Anthony Weiner announces his candidacy for Mayor of New York Watch on YouTube

Read more on NBCNewYork.com

The video announcing his run is set around New York City and highlights his mother’s career as a public school teacher and father’s as a lawyer who trained under the G.I. Bill.

“Theirs was a classic New York story,” he said. “You work hard, you make it into the middle class and make life a little bit better for your kids. That’s how this city was built. But it is getting harder and harder every day.”

Weiner said he would tackle a slew of issues facing the middle class, including rising rents and house prices and regulations stifling small businesses, and champion education, safety, and “real” health reform.

“The very people who put everything they had into this city are getting priced right out of it,” he said in the video.

Elsa / Getty Images, file Anthony Weiner, seen at a Brooklyn Nets-Toronto Raptors game in November, hopes people will give him a "second chance."

Weiner’s Democratic opponents include City Councilman Sal Albanese, Public Advocate Bill de Blasio, Comptroller John Liu, City Council Speaker Christine Quinn, the Rev. Erick Salgado, a pastor, and former Comptroller Bill Thompson, The Associated Press reported.

On the Republican side, he is likely to face billionaire businessman John Catsimatidis, former Metropolitan Transportation Authority Chairman Joseph Lhota and homelessness-aid organization head George McDonald.

Former White House housing official Aldolfo Carrion Jr., a Democrat who recently dropped his party affiliation, is running on the Independence Party line and also interested in the Republican nomination, the AP said.

A recent poll found that if Weiner entered the race, he would get 15 percent of Democratic votes, putting him in second place after City Council Speaker Christine Quinn, but much less that he would need to achieve an outright victory, according to NBCNewYork.com.

Weiner ran for mayor in 2005, and came close to forcing a runoff against Fernando Ferrer – his party’s eventual nominee. He was considered a main contender in 2009 but quit the race after current Mayor Michael Bloomberg decided to run for a third term.

The Associated Press contributed to this report.

Related:

Off to the races: Weiner could jump into NY mayor’s race next week

Weiner 'can't say with certitude' that lewd photo isn't of him

Weiner admits to 'several' racy online relationships

