Anthony Weiner, the disgraced former congressman who polls suggest is a leading candidate for mayor of New York, admitted Tuesday that he engaged in a series of sexually explicit communications with a young woman on the Internet.

The behavior allegedly occurred in 2012, more than a year after Weiner was forced to resign from Congress after admitting to similar episodes. But in a news conference that seemed a little like a public therapy session, Weiner stood with his wife, Huma Abedin, and vowed to stay in the race for mayor.

According to a gossip Web site called the Dirty, the Democratic ex-congressman, using the pseudonym “Carlos Danger,” exchanged obscene messages and nude pictures and engaged in phone sex with an unidentified woman, then 22.

In 2011, Weiner resigned his House seat so that he and his wife, a longtime aide to then-Secretary of State Hillary Rodham Clinton, could “continue to heal from the damage I have caused” by his behavior.

The latest revelations suggest that Weiner was engaging in reckless, lewd behavior at the very time he was launching a public rehabilitation campaign, with a warmly lighted photo spread of the couple and their infant son in People magazine. It was accompanied by a story that quoted Abedin as saying her husband was “trying to be the best dad and husband he can be.”

Weiner’s campaign released an ambiguous statement, which he later read at the news conference, that did not dispute the woman’s version of events.

“I said that other texts and photos were likely to come out, and today they have,” Weiner said. “As I have said in the past, these things that I did were wrong and hurtful to my wife and caused us to go through challenges in our marriage that extended past my resignation from Congress.”

“While some things that have been posted today are true and some are not,” he continued, “there is no question that what I did was wrong. This behavior is behind me.”

Abedin, managing a tight smile, also spoke at the news conference, saying, “I love him, I have forgiven him, I believe in him, and, as we have said from the beginning, we are moving forward.”

Abedin’s stance evoked comparison with that of her mentor, Clinton, whose steadfastness in her marriage to Bill Clinton and their joint political ambitions helped rescue her husband from the sex scandal involving White House intern Monica Lewinsky that nearly ended his presidency.

But unlike Weiner, Bill Clinton would never be on the ballot again. And the office that Weiner is seeking is the biggest prize in New York City politics.

While it is true that pretty much anything can happen in an election — especially in New York — the latest revelations have, at a minimum, damaged the remorse-and-redemption theme that fueled Weiner’s mayoral bid.

That story line, along with his celebrity, propelled him in the polls into a dead heat with City Council Speaker Christine C. Quinn, who was long presumed to be the front-runner to win the Sept. 10 Democratic primary.

“In many ways, things are not that different than they were yesterday,” Weiner said at the news conference.

That, however, may be wishful thinking.

In today’s politics, “the time frame to recuperate, recover and come back is much shorter than it used to be,” said Chris Lehane, a former Clinton White House official who now specializes in crisis management communications. “Generally speaking, though, you only get one bite at the apology apple.”

Adding another challenge to Weiner’s plan — and to the capacity of New Yorkers to forgive and move on — is the fact that another politician tarnished by a sex scandal, former governor Eliot L. Spitzer, is also attempting a comeback in the Democratic primary. Spitzer surprised the political world with an announcement on July 8 that he is running for city comptroller.

When the earlier scandal involving Weiner broke in June 2011, Abedin was pregnant. She gave birth to the couple’s son in December of that year.

By this year, Weiner was positioning himself for an audacious return to the spotlight.

In April, the New York Times Magazine profiled the couple in an 8,000-word story. It portrayed Weiner as a homebody and primary caretaker for his son — “going to the park with Jordan; picking up his wife’s dry cleaning and doing the grocery shopping; eating at his brother Jason’s two restaurants in the neighborhood” — who was also taking a serious look at returning to politics.

That article, according to the woman with whom he exchanged lewd messages, coincided with his last contact with her. “He reactivated his Facebook and asked me what I thought of it,” she told the Dirty.

Six weeks later, Weiner announced that he was running for mayor.

He has campaigned vigorously, at times citing his own challenges alongside those of former South African president Nelson Mandela and Franklin D. Roosevelt. But Weiner, in a dozen years in Congress, has a much slimmer record of achievement. He was known mainly as a verbal combatant on the House floor and on cable news channels.

At one point during the exchanges that were published by the Web site, the woman told Weiner that she had noticed him while he was in Congress and been attracted to him long before they met over the Internet. “Specifically your health care rants were a huge turn on,” she said.