San Francisco Mayor Gavin Newsom's re-election campaign manager resigned Wednesday after confronting the mayor about an affair Newsom had with his wife while she worked in the mayor's office, City Hall sources said.

Alex Tourk, 39, who served as Newsom's deputy chief of staff before becoming his campaign manager in September, confronted the mayor after his wife, Ruby Rippey-Tourk, told him of the affair as part of a rehabilitation program she had been undergoing for substance abuse, said the sources, who had direct knowledge of Wednesday's meeting.

Rippey-Tourk, 34, was the mayor's appointments secretary from the start of his administration in 2004 until last spring. She told her husband that the affair with Newsom was short-lived and happened about a year and a half ago, while the mayor was undergoing a divorce from his then-wife, Fox News host Kimberly Guilfoyle, said the sources, who spoke on condition they not be identified.

Alex Tourk "confronted the mayor on the issue this afternoon, expressed his feeling about the situation in an honest and pointed way, and resigned," said one source close to Tourk and his wife.

Tourk's resignation was announced in a statement that Newsom's campaign released Wednesday. The statement quoted Tourk as saying only that he was resigning for personal reasons.

The statement quoted Newsom, 39, as saying he had accepted the resignation with great sadness.

Asked at City Hall Wednesday evening about Tourk's resignation and the affair, Newsom said, "I'm not making any public comment. I'm just not."

Tourk and Newsom have been friends for years and frequently socialized outside work. Tourk did not return phone calls Wednesday seeking comment. Rippey-Tourk, who now hosts a weekly radio show for Benefit Magazine in San Francisco, also did not return calls. A family friend who asked not to be identified said she would have no comment.

Reports of the affair come at a particularly sensitive time for Newsom, who is embarking on his campaign for re-election in November. The mayor's personal life has come under scrutiny in recent weeks. In December, several witnesses at a late Friday night vigil for a mortally wounded police officer at San Francisco General Hospital reported that Newsom appeared to have been drinking when he arrived. A spokesman for the mayor declined to comment on those reports.

The controversy involving Tourk left Newsom's inner circle reeling. "I feel really bad for Alex," one adviser said. "He is blameless in this."

After meeting with Tourk, Newsom maintained his public schedule, which included attending a reception for city commissioners and officiating over a marriage in his office.

Privately, however, aides said the mayor was in shock over the meeting.

Polls have consistently shown Newsom's approval ratings among city voters topping 70 percent, unusually high for a politician in his fourth year in office. Although his relations with the Board of Supervisors have deteriorated over the past year, no competing candidate has emerged for this year's mayoral race.

One person who says he intends to challenge Newsom, former Supervisor Tony Hall, said Wednesday night that he hoped news of the affair was not true. But if it is, he said, "the city deserves much better than what it's getting."

Eric Jaye, Newsom's chief political adviser, said he was confident that any political damage to the mayor would soon dissipate.

"There will be a minor amount of turbulence, but as long as the mayor continues to do his job, it will have no lasting effect," Jaye said. "Ultimately, politicians are judged by how they do their jobs as elected officials."

Newsom's predecessor as mayor, Willie Brown, said that "any time you have a scandal associated with sex and relationship, there is no way to predict how the public will react. In my own experience, you just have to be prepared to ride with the storm. You can't shut it down and stop it."

Newsom's chief City Hall rival, Supervisor Chris Daly, refused to speculate about how publicity over the affair would affect the mayor's career.

"I think there's a lot of time to figure that out," he said. "Right now is not the time. I really think the day this hits the papers, the focus should be on the actual human lives involved."

Other critics of Newsom said the news spoke volumes about the mayor.

Jack Davis, a political consultant who helped elect Brown and former Mayor Frank Jordan and was looking for someone to challenge Newsom, said, "There is nothing new in that story that I haven't been aware of for the last six months. Now that it's public and out there, Gavin ought to resign and seek psychiatric help."

Tourk worked as an aide to Brown before joining Newsom's first mayoral campaign in 2003. The next year, he became Newsom's deputy chief of staff and served as one of the mayor's key strategists.

He was instrumental in turning Newsom's idea of inviting homeless people to one location and providing them with myriad services into a reality. Almost 15,000 people have since received services during more than a dozen Project Homeless Connect days in San Francisco.

In his resignation statement, Tourk said, "I am honored that, as deputy chief of staff, I helped create and implement key policy initiatives such as the Homeless Connect program that is now a national model for its compassionate and comprehensive approach to helping the homeless."

Newsom's statement said Tourk "was instrumental in my first election, organizing a strong early re-election effort, and shaping successful policy during his service with the city and county of San Francisco. We all wish Alex well and know he will be successful in all of his future endeavors."

While running Newsom's re-election campaign, Tourk helped the mayor raise about $620,000 from supporters around the country. He has been paid about $50,000, Jaye said.

"The campaign will move forward and will not be distracted by this," Jaye said.