Representative Anthony D. Weiner, a once-promising politician whose Brooklyn roots and scrappy style made him a leading candidate to be the next mayor of New York, resigned his seat on Thursday, ending a three-week scandal over his lewd online behavior that startled his constituents and alienated many of his colleagues.
Mr. Weiner made the decision after long and emotional discussions with his political advisers and his wife, Huma Abedin, whom friends described as devastated by the behavior of her husband of 11 months, and worried about the couple’s financial future.
In a chaotic four-minute news conference at a senior center in his district, Mr. Weiner, 46, strained to be heard as a small group of hecklers hollered vulgar questions at him and called him a “pervert” while puzzled elderly constituents looked on.
“I am here today to again apologize for the personal mistakes I have made and the embarrassment I have caused,” Mr. Weiner said.
A seven-term Democrat, Mr. Weiner had hoped his declaration last weekend that he would seek mental health treatment and take a temporary leave from Congress would ease the pressure from Democratic leaders for him to step down. But their demands only grew louder as revelations about his conduct continued.
“I am announcing my resignation from Congress, so my colleagues can get back to work, my neighbors can choose a new representative and most important so that my wife and I can continue to heal from the damage I have caused,” Mr. Weiner said at the news conference.
Ms. Abedin was with Mr. Weiner at his Queens apartment as he prepared to make his statement, but did not appear at his side at the event.
The announcement brought swift relief to his Democratic colleagues, who had become increasingly uneasy as details emerged about Mr. Weiner’s online contacts with women — including his sending of explicit photos of himself to them over Facebook and Twitter. Democratic leaders had prepared to hold a meeting on Thursday to determine whether they should strip Mr. Weiner of his committee assignments, which would have severely impaired his effectiveness.
Mr. Weiner reached his decision late Wednesday, and seemed at peace with it, after days of appearing frazzled and torn, a person who spoke to him said. He began telling his most trusted advisers on Wednesday night, then held a conference call with his entire staff, informing them that it no longer seemed fair to his constituents and his colleagues for him to remain in office.
At about 8:45 p.m., he called Representative Steve Israel of New York, chairman of the Democratic Congressional Campaign Committee, who was attending a White House picnic on the South Lawn, alongside hundreds of lawmakers enjoying hamburgers and patriotic music from the United States Navy Band.
Mr. Israel, after hearing the news from Mr. Weiner, sought out Representative Nancy Pelosi of California, the House Democratic leader, in the crowd and handed his cellphone to her so Mr. Weiner could tell her his plans himself.
Ms. Pelosi had taken an aggressive posture with regard to Mr. Weiner, including the rare step on Saturday of calling for him to leave the House. On Thursday morning, she released a statement saying he had “made the right judgment in resigning.”
Gov. Andrew M. Cuomo must now call a special election to fill the vacancy created by Mr. Weiner’s departure. But the Ninth Congressional District, which covers Queens neighborhoods like Forest Hills and Howard Beach as well as Brooklyn sections like Midwood and Mill Basin, is a likely target for elimination as state lawmakers redraw district lines for 2012.
The scandal that upended Mr. Weiner’s career erupted late last month after a photograph of the congressman wearing tight-fitting underpants was sent to a college student in Washington State. Mr. Weiner initially denied having anything to do with it, saying his Twitter account had been hacked. But during an emotional news conference on June 6, he admitted that he had lied, and that he had in fact sent the image and had had inappropriate online exchanges with at least six other women.
As the story engulfed him, Mr. Weiner spoke regularly with advisers and Ms. Abedin, a top aide to Secretary of State Hillary Rodham Clinton, who was traveling on a 10-day trip to North Africa and the Middle East.
The decision to step down was ultimately Mr. Weiner’s, but Ms. Abedin supported it, convinced that the embarrassing disclosures would not stop until he left office, according to friends who have spoken to her.
One of the friends described Ms. Abedin, who appeared composed and poised on the trip abroad, as devastated and shocked by Mr. Weiner’s behavior. But Ms. Abedin, who is pregnant, intends to stay with her husband, at least for now.
“I don’t think she has made a firm decision, but she is very loyal,” said the friend, who requested anonymity so as not to betray confidential conversations.
Neither Ms. Abedin nor Mr. Weiner earn lucrative salaries, and Ms. Abedin is worried about her husband, who has been in politics much of his adult life, finding work. Mr. Weiner would still be eligible to collect his pension after his resignation.
It was not clear what would happen to Mr. Weiner’s announced plans to enter a treatment center; on Thursday night, a spokeswoman, Risa Heller, had no comment.
But an Ethics Committee investigation opened by the House into his conduct is expected to end as a result of his resignation, because the committee has jurisdiction only over members of Congress. And Mr. Weiner will retain control of more than $4 million in his campaign account.
It has been a precipitous fall for Mr. Weiner, a media-savvy politician with a knack for identifying hot-button issues, who had been considered a leading candidate for mayor in 2013.
Mr. Weiner was first elected to Congress in 1998, capturing the seat that had been vacated by his political mentor, Charles E. Schumer, who won a seat in the United States Senate that year. Prior to entering Congress, Mr. Weiner was the youngest person ever elected to the City Council, where he served for eight years.
Despite his successes, Mr. Weiner could be abrasive, and some colleagues wrote him off as a publicity seeker unwilling to put in the hard work needed to pass serious legislation.
Still, even as the story about his online exploits dragged on, some constituents stayed loyal to him. Vicky Hodja, 53, came out to support Mr. Weiner, who always showed up at her children’s school to hand out awards for stellar attendance and good behavior.
She said Mr. Weiner’s wife was “very smart,” and urged her to ignore any suggestion that she leave her husband.
“If she wants to have a marriage and a life,” Ms. Hodja said, Ms. Abedin should consider modeling her behavior on that of her boss, Mrs. Clinton, who famously stood by President Bill Clinton during marital infidelities.
“Human beings make mistakes,” she said, “but they learn from their mistakes.”
Mr. Weiner’s news conference was brief, but the circuslike atmosphere continued after he had left the podium.
Benjy Bronk, a writer for “The Howard Stern Show” who had heckled the congressman during the appearance, held his own session with reporters outside explaining his outburst.
“I’m trying to get to the truth and, uh, get on camera,” he said.