City Council Speaker Corey Johnson has ended his bid for mayor — saying he is doing so to focus on the city and his own mental health issues.

The decision, which followed a rough summer for the speaker, was announced in a statement Thursday.

“It was no secret that I had been considering a run for Mayor, and that I have put my campaign on pause for the past six months.

“I felt strongly that it was the right thing to do considering all that our city has been going through, including COVID-19, the resulting shutdown and economic pain, and the long-overdue national reckoning on race.

“Just as I was open about the fact that I was considering a run for Mayor, I now want to be open about the fact that I have made the difficult decision not to run. This challenging time has led me to rethink how I can best be of service to this city, and I have come to the conclusion that this is not the right path for me,” his statement said.

An ongoing, personal struggle with depression is another reason he is exiting the 2021 race, Johnson said.

“In the same spirit of openness, I would also add that I have been dealing with some personal challenges over the past few months, namely — depression,” he wrote.

“I am sharing this because I know from experience the value of speaking honestly about one’s struggles. I’ve been open about my sobriety, which along with my partner and mother, has been instrumental to me during this difficult time, and my HIV status.

“I believe it’s important to be open about this as well. Too often mental health issues are shrouded in secrecy and stigmas, which causes people struggling with these issues to feel alone. I encourage anyone who is experiencing a mental health condition to seek help. I did and I am better for it.”

Johnson’s sudden exit leaves Comptroller Scott Stringer and Borough President Eric Adams as the twin frontrunners for the 2021 Democratic mayoral primary. Both have raised more than $2 million so far.

But they will face two expected tough challenges from former de Blasio top adviser Maya Wiley and ex-Sanitation Commissioner Kathyrn Garcia, who are both expected to make late splash entrances into the race.