NASHVILLE — Mayor Megan Barry, the first woman to lead this city, has been the kind of politician who seemed to effortlessly reflect the tenor of her place and time. Like others in booming Nashville, she is an ambitious transplant, socially liberal but business-friendly, a non-Southerner comfortable in a Southern context. It is a formula that has earned her poll numbers that would be the envy of any politician.

But in recent days, scandal has threatened to dim one of the Democratic Party’s brightest Southern stars. And though many residents of Nashville, a bastion of social liberalism in a deeply conservative state, have been willing to dismiss with a kind of Gallic shrug her admission of a monthslong extramarital affair with the police officer leading her security detail, other aspects of the episode are mounting, leading some here to wonder how long she can hang on.

Ms. Barry, 54, a former corporate ethics and compliance officer who became mayor in September 2015, announced the affair at a somber and apologetic news conference last Wednesday, and insisted that it was over.

“I am embarrassed and I am sad and I am so sorry for all the pain that I have caused my family and his family,” she said, referring to former Sgt. Robert Forrest Jr. of the Metro Nashville Police Department, who is also married and who retired from the force at the end of last month. “And I know that God will forgive me — but that Nashville doesn’t have to.”