As long as the San Francisco 49ers had a chance to win the NFC West, coach Mike Singletary had a job.

Sunday night, hours after the 49ers were eliminated from playoff contention with a 25-17 loss in St. Louis, Singletary was fired by club president Jed York.

It was York who stood up for Singletary after a 0-5 start, predicting that the horrible start notwithstanding, Singletary was his coach and the 49ers would win the NFC West.

No team in history had made it to the playoffs after an 0-5 start, but coming into Sunday’s game in the Edward Jones Dome, the 49ers just needed to win twice by beating the Rams Sunday and Arizona next weekend. They also needed Seattle to lose at least once. The Seahawks help up their end, but the wretched performance by the 49ers left them eight points short and Singletary without a job.

The firing was officially announced by the club after returning to the Bay Area Sunday night. Singletary, who has two years left on his contract, was told of his dismissal after the team returned to its headquarters in Santa Clara.

“One of the greatest experiences of my life was having the opportunity to coach the San Francisco 49ers,” Singletary said in a statement released by the club. “What made it so special were the players. They were some of the most outstanding men I have ever been around in my life. The coaches were truly professionals.

“I wish the 49ers nothing but the best. I am thankful to the York family for having given me the opportunity to be a head coach in the NFL. I am indebted to them for that. I am also thankful for the faithful fans, I am just sorry I couldn’t give them more.”

Promoted for the final week of the season was defensive line coach Jim Tomsula, who will be introduced as such by the club Monday in a news conference.

York was noncommittal about Singletary’s future immediately after the game, but he confirmed it to multiple Bay Area outlets, including the San Francisco Chronicle and, later in the evening.

Talking in St. Louis before the return trip home and the firing, York talked about his plans for the future.

“Money is no object,” York told the San Francisco media immediately after the game. “I mean, our object is to win the Super Bowl, year in and year out be there and compete for Super Bowls. We’re going to make sure we get this right.”