Marvin Lewis has won four division titles in 15 years with the Bengals. (Gary Landers/Associated Press)

As it turns out, the Cincinnati Bengals’ final two games of the season, in which they were underdogs against the Detroit Lions and Baltimore Ravens but won to end both teams’ playoff hopes, were not a fitting way to send off Marvin Lewis. Cincinnati’s longtime head coach isn’t going anywhere, as the team announced Tuesday that he signed a two-year deal to remain in that position.

Lewis’s just-completed 15th season with the Bengals featured plenty of speculation that it would be his last, particularly after ESPN’s Adam Schefter reported in mid-December that the 59-year-old coach would leave to “pursue opportunities elsewhere.” However, Lewis made it clear by the end of the 7-9 campaign that his preference was to stay on in Cincinnati, and the team said it was “happy” to keep him.

“Marvin Lewis has been an important member of the Cincinnati community and the Bengals family for the past 15 years, and we are happy to have reached this agreement,” Bengals owner and President Mike Brown said in a statement. “Marvin has made significant contributions during his time here. While recently we have fallen short of our expectations, we have full confidence in Marvin to reestablish winning football in 2018.”

“My family and I are very grateful for the opportunity to stay in Cincinnati and continue my career with the Bengals,” Lewis said in a statement. “My job is to win a World Championship. We have a talented roster full of veteran leaders and emerging young stars, and I am committed to making the necessary improvements to put this team in the best position to win.”

Including a 6-9-1 mark in 2016, the Bengals haven’t been doing much winning the past couple of years, but over his decade-and-a-half run in Cincinnati, Lewis has compiled a record of 125-112-3, with more double-digit-winning seasons (six ) than losing seasons (five). However, he has an 0-7 record in the playoffs, worst among coaches in NFL history, including a streak of five straight one-and-done postseason appearances that ended after the 2015 season.

In the Super Bowl era, Lewis and the Steelers’ Chuck Noll are the only coaches to have gone at least 12 straight years with one organization while not taking it to the championship game, but, of course, Noll had won four Super Bowls before his streak began. Nevertheless, Lewis is poised to become just the fifth man in the era to coach a team for 17 years (per, joining Noll, the Dolphins’ Don Shula, the Patriots’ Bill Belichick and the Titans’ Jeff Fisher.

“I think he’s a heck of a coach,” said Bengals tight end Tyler Kroft, shortly after his team stunned the Ravens on Sunday, 31-27. “I love playing for coach Lewis. But that [decision on whether he returns] is above my pay grade.”

“Mike wanted to know how I can get the team better,” Lewis said Tuesday. “Getting back to winning the division, going deep in the playoffs and winning the Super Bowl. The first thing we have to do is coach better and set it up better.”

The AP NFL coach of the year in 2009, Lewis took over the Bengals in 2003 and quickly gained credit for bringing respectability to a franchise that had been the laughingstock of the league. From 1991 through 2002, Cincinnati did not have a winning season and had eight seasons of five wins or fewer.

Before Lewis arrived, Sam Wyche and team founder Paul Brown were tied at eight seasons each as the Bengals’ longest-tenured head coaches. Lewis’s previous coaching jobs included defensive coordinator for the Redskins in 2002 and defensive coordinator for the Ravens from 1996 to 2001, during which Baltimore won Super Bowl XXXV with what is regarded by many as one of the NFL’s all-time greatest defenses.

Read more from The Post:

Power ranking the NFL playoff teams — Patriots, Vikings and Steelers lead the way

The ‘mother of all stats’ doesn’t see the Patriots as Super Bowl contenders

Examining the Redskins’ top quarterback options if Kirk Cousins leaves

‘I think I am being considered, yes’: ESPN’s Jon Gruden on becoming the Raiders’ next coach