A man's gotta do what a man's gotta do, but that doesn't mean it leaves a good taste.

Matt Klentak, 30-something analytics fiend, on Friday dismissed Pete Mackanin, 60-something baseball lifer, after Mack turned the worst team with the worst roster in the major leagues into something respectable by the season's end. Thank you very much. Please clean out your desk and take the elevator to the front office.

What we learned Tuesday from team president Andy MacPhail was that, when MacPhail hired Klentak as general manager in October 2015, he hired him to one day fire Mack.

"I always expected when we extended Pete [in May] that we were eventually going to pass the baton to another manager," MacPhail said.

The only road to retention for Mackanin lay in a miraculous run to glory, such as the one Charlie Manuel made in 2006 and 2007 after Pat Gillick replaced Ed Wade. The difference: Manuel had one future MVP leading off, another batting cleanup, a six-time All-Star playing second base, and an ace at the front of his rotation.

Mack had Dom Brown and Darin Ruf.

Mack never had a chance.

MacPhail understood the possible negative reaction in Philadelphia to firing a manager so strikingly Philadelphian. Mackanin was knowledgeable, patient and blatantly honest about the most sensitive things, such as his players' performance, his players' behavior, and the putrid rosters he was given. That's why Mack received a standing ovation from the fans at Citizens Bank Park and from his team before Sunday's finale. He was an underdog who fought a hopeless fight with exceeding dignity and grace.

Baseball seldom concerns itself with fairness or sympathy, and, frankly, Klentak owes Mackanin nothing. He inherited Mack. If Klentak, a Dartmouth man, wants to hire an Ivy mind or a numbers freak or a buddy from his Angels days, that is his right and that is his duty. It is why MacPhail, 64 and just two years younger than Mackanin, hired Klentak, 37, in the first place: to build this team in his image over the next 15 or 20 years. It's why MacPhail left this decision in Klentak's hands, because it's Klentak who will have to live with it.

"The GM only gets so many managers," MacPhail said.

As such, MacPhail told Klentak that if he believed Mackanin was not the perfect man to run the rest of the rebuild, then Klentak must ignore any public outcry; that Klentak had no choice but to fire Mackanin.

"He understood. He's unafraid. He feels like it was the appropriate time," MacPhail said. "That was not an easy thing for Matt to do. He knew it was the young guy reassigning the old guy. … He understood that had he felt that way and not taken action, he essentially would not have been doing what his job requires him to do."

Again: A man's gotta do what a man's gotta do. That doesn't mean it shouldn't disturb you.

To be fair, Mackanin didn't do everything right.

It took him four months to find a dependable closer. Third baseman Maikel Franco gained weight and regressed. First baseman Tommy Joseph went backward, too. Odubel Herrera is still a knucklehead. It might be unjust to blame Mackanin for any or all of these issues, but a manager answers for everything. That includes conditioning and discipline.

Still, none of these shortcomings justified dismissal, even when considered in aggregate. To Klentak's credit, he cited none of them. In fact, there is more and better evidence to retain Mack for 2018 than to fire him.

Nick Williams and Aaron Altherr blossomed. Aaron Nola established himself as a promising starter, and Hector Neris developed into a viable closer. Up the middle, Freddy Galvis became an elite fielder and Cesar Hernandez was the club's most consistent player. Rhys Hoskins set rookie records, J.P. Crawford acclimated himself, and Jorge Alfaro hit .318 with five homers in 29 games.

The team went 36-35 down the stretch, which was a much better gauge of Mackanin's ability than any other group of games. Mackanin finally had stability in those 71 games.

Remember, Mack replaced Ryne Sandberg in the middle of 2015, a season of frustration in which Chase Utley, Ryan Howard and Brown all hit less than .230 with on-base percentages below .285. Mack agreed to the extension MacPhail offered that September, but again was handed Howard, who faded further, as well as Ruf and Cody Asche.

It's tempting to point to Hoskins as the guy who made the difference, and to say that Mackanin had little influence over Hoskins' success. Yes, Hoskins carried the club for a while, but don't give him all the credit for the late surge. The Phillies were on a 12-8 run before he arrived, then went 24-27. Williams played in all 71 games and hit .292 with 11 homers. Herrera hit .319 with a .373 on-base percentage. Mackanin's players produced; but, clearly, the die was cast. In fact, it was cast in the fall of 2016.

That was when Klentak declined to offer Mackanin an extension through 2018. Mackanin entered the 2017 season as the lame-duck skipper of a young, leaderless team with one player under contract beyond 2017 (Herrera). Eventually, on May 11, Klentak did what he should have done months earlier and extended Mack's contract.

It was the day after veteran reliever Joaquin Benoit insubordinately and absurdly questioned his usage. Klentak finally realized that Mackanin needed job security to control the clubhouse through 2017. It was very little, very late, but it's important to remember that Klentak is new at this, too.

The new contract was laughably transparent. The deal ran only through next season, so it just put Mackanin and Klentak in the same position they were in at the end of 2016. Mackanin would have been a lame-duck manager again in 2018 unless he got another extension this fall or winter. Klentak knew Mackanin was facing another season of futility. He knew virtually nothing would change that.

Think about it. Would Mackanin have been retained if Franco hit .280 with 30 homers, instead of .230 with 24? If Tommy Joseph finished at .270 with 28 homers, instead of .240 with 22? If Herrera matured into a combination of Dykstra and Rose? If 66 wins had been 76? No.

Friday's awkward announcement was not a revelation.

It was a sour inevitability.