Boston Mayor Martin J. Walsh isn’t ruling out the possibility of running for Senate — but only if a seat were to become open, the New York Times reported Friday.

But as Representative Joseph P. Kennedy III publicly mulls whether he’ll challenge Senator Edward J. Markey, Walsh suggested he would only look at the seat if the incumbent steps aside.

“I’m not going to run against Ed Markey,” he told the paper.

And, for his part, Markey has insisted he is running for re-election.

“This is the most energized that I have ever been in my life,” he told the Globe earlier this week, citing what he called “the threat that Donald Trump poses to everything that Massachusetts stands for.”


Walsh told reporters this week that he was backing Markey. Walsh has also been floated as a possible candidate for governor, and a June Suffolk/Globe poll found him in a statistical tie with Attorney General Maura Healey in a hypothetical Democratic primary race for governor.

Kennedy’s potential challenge has thrown the Massachusetts political landscape into flux as Democratic officials across the state are pressed to take sides, and candidates line up to express interest in Kennedy’s Fourth District should it become open.

Reached for comment, Walsh’s office verified the accuracy of the mayor’s remarks to the New York Times.

Christina Prignano can be reached at christina.prignano@globe.com. Follow her on Twitter @cprignano.