Washington (CNN) -- Democratic Rep. Anthony Weiner heeded calls from across the political spectrum by resigning from office Thursday, saying the sexting scandal he first lied about and then admitted caused such a distraction that it was impossible for him to continue his work in Congress.
In a brief statement to reporters interrupted repeatedly by a heckler, the New York congressman apologized "for the personal mistakes I have made and for the embarrassment I have caused" to his neighbors, to his constituents and "particularly to my wife."
"Unfortunately, the distraction that I have created" made it "impossible" to continue working in Congress, Weiner said.
He was greeted by some cheers when he entered the room at a community center in his home district to make the announcement. One onlooker, however, heckled Weiner by shouting "pervert" and later yelled insulting questions as Weiner spoke. The heckler turned out to be a writer for shock jock Howard Stern who goes by the name Benjy Bronk, and he offered little explanation for why he taunted the congressman.
Weiner, 46, was considered a possible front-runner to succeed New York Mayor Michael Bloomberg in 2013 until the revelation in late May of his online communications, including lewd photos of himself he sent to women he befriended on Facebook and Twitter.
After initially claiming that the first picture to be made public resulted from his account being hacked, Weiner eventually admitted that he sent the picture and had engaged in several inappropriate online relationships with women he contacted through social networking sites.
House colleagues wished Weiner well Thursday while acknowledging his failures.
"Congressman Weiner exercised poor judgment in his actions and poor judgment in his reaction to the revelations," said a statement by House Minority Leader Nancy Pelosi, D-California, who had pushed Weiner to step down. "Today, he made the right judgment in resigning."
Weiner's political mentor, Democratic Sen. Chuck Schumer of New York, called it a sad day, adding that Weiner "was an effective and passionate advocate for the people he represented in Brooklyn and Queens" who "served his community, city, and country well for over two decades."
Others noted that the scandal surrounding Weiner had become a distraction.
Democratic Rep. Steve Israel, D-New York, issued a statement saying that Weiner's decision to resign "is right for him and his family, our party, and our country because we have serious work to do in Congress."
"Last week Republican leaders introduced a bill to privatize Social Security, and the American people deserve an undistracted debate on it, Medicare, jobs, and other important issues," Israel's statement said, reflecting the desire of Democrats to refocus the national debate after more than two weeks.
Republican Rep. Peter King, who once engaged in a shouting match with Weiner on the House floor, said Weiner had to resign because he would have been rendered ineffective in Congress.
King called Weiner "talented" and said, "I always felt he was so ambitious, so driven to succeed, that apart from morality or anything else, that he would never leave himself so exposed, as he's done, so literally."
To fill Weiner's seat, New York Gov. Andrew Cuomo will call a special election on a date to be determined. A brief statement from Cuomo's office said Thursday that the governor " will take the appropriate steps to ensure New Yorkers in the 9th district are fairly represented in Congress."
Dave Arnold, Weiner's communications director, said the congressman's staff would remain employed until the day of the special election.
A similar special election took place in New York last month after the resignation in February of Republican Rep. Chris Lee over a Craigslist solicitation that included his shirtless photo.
Top leaders from both parties, including President Barack Obama and House Speaker John Boehner, had said or suggested that Weiner should step down over the controversy, which has been a major story since the news emerged in late May.
Weiner announced that he was seeking treatment and requested a two-week leave from Congress that was granted without objection. However, Weiner resisted the calls to resign, bolstered by polling that showed a majority of residents in his district wanted him to stay on.
With more revelations of the sexually tinged online communications emerging and the story continuing to dominate headlines, Weiner changed his mind this week after his wife, Huma Abedin, returned from an overseas trip with Clinton.
Weiner called Israel on Wednesday to tell him he was going to resign, said a source familiar with that conversation. Israel, who was at a White House picnic for members of Congress, then got Weiner on the phone with Pelosi, the source said.
Israel and Pelosi went near a tree on the White House grounds to talk to Weiner in private, according to the source. Weiner told them that he was resigning and was very remorseful about what he did to his family and his colleagues, especially for causing such a distraction, the source added.
Weiner also told Israel and Pelosi that he had talked to his wife, who is pregnant with the couple's first child.
Pelosi said earlier Thursday that Democratic leaders "respectfully gave him time and his wife came home for them to talk."
Back in Weiner's home district, supporters praised the congressman for working on their behalf but criticized his behavior, while opponents said good riddance.
"We really appreciate what he's done for us," said Ruth Rootenberg, a 30-year resident. "What he did on a personal level isn't something we approve of."
As for Weiner's future, Rootenberg said, he "had a very good chance at being mayor, but at this point I'm not so sure."
"His constituents are behind him," she said, adding: "There's always a chance."
However, Ruben Noyman said that he never voted for Weiner and that the congressman's resignation is the "smart thing to do."
"He's a disgrace," Noyman said.
Democratic Rep. Ed Towns of New York said he hoped Weiner could "bounce back and run for something else, and knowing him, he probably will," while Rep. Bill Pascrell, D-New Jersey, said Weiner probably could have survived the scandal if he had come clean right away instead of lying about it.
From all indications, the story wasn't going away. On Wednesday, a former adult film actress currently working as a stripper said she exchanged e-mails and Twitter messages with Weiner for more than two months. The woman, whose lawyer identified her as Ginger Lee, said in New York that Weiner asked her to lie about it after the scandal broke.
Lee said that although she initially admired Weiner for his liberal views on Planned Parenthood and health care, her view of the congressman has changed.
"I think that Anthony Weiner should resign because he lied to the public and the press for more than a week," Lee said. "If he lied about this, I can't have much faith in him about anything else."
Her lawyer, Gloria Allred, read some of the scores of e-mails that she said Weiner sent to Lee.
"I have wardrobe demands too," said one, according to Allred. "I need to highlight my package."
Lee said she never reciprocated when Weiner made suggestive comments. Allred said Lee, who is single, never met Weiner and never received any photographs from him.
First elected to the House in 1998 after Schumer decided to run for the Senate, Weiner has been a reliable liberal voice for the solidly Democratic 9th District, encompassing parts of Brooklyn and Queens.
Weiner basically ran unopposed in 2006 and 2008 and won by 22 points over his Republican opponent in 2010, easily avoiding the GOP tidal wave that swept over the House.
As a politician, Weiner fully embraced social media sites such as Twitter and Facebook, using the platforms to unleash his comedic take on life and politics.
He graduated from the State University of New York Plattsburgh and worked as an aide to Schumer from 1985 to 1991. A year later, he served on the New York City Council.
He ran unsuccessfully in the Democratic mayoral primary race in 2005. Most observers now feel the scandal has ruined any chance of his being elected mayor in 2013.
CNN's Tom Cohen, Meghan Rafferty and Raelyn Johnson contributed to this report.