John Harbaugh is trying to get the Ravens back into the playoffs after a three-season drought. (Todd Olszewski/Getty Images)

With the Baltimore Ravens poised to potentially end a three-season playoff drought, they moved Friday to clear up the uncertainty about John Harbaugh’s future, saying he will be retained as the team’s coach next season.

The team also said a contract extension for Harbaugh was in the works. There had been intense speculation that Harbaugh would be fired if the Ravens missed the postseason for a fourth straight year.

“John Harbaugh will continue as our head coach for the 2019 season, and he and we are working on an extension to his existing contract, which expires after the 2019 season,” the Ravens said in a written statement.

The Ravens take an 8-6 record into their Saturday night game at the Los Angeles Chargers. They hold the second of two wild-card spots in the AFC and are only a half-game behind the Pittsburgh Steelers for the AFC North lead.

The team reached the playoffs in six of Harbaugh’s first seven seasons as its coach. That run of success included a Super Bowl title in the 2012 season.

But the Ravens had a combined record of 22-26 the next three seasons, missing the postseason each time. Owner Steve Bisciotti has said he considered firing Harbaugh after last season’s playoff near miss, in which the Ravens went 9-7 but were eliminated from postseason contention with a down-to-the-final-minute loss to the Cincinnati Bengals in Week 17. So many observers found it natural to assume it would take a playoff appearance, or perhaps even a postseason victory or two, for Harbaugh to keep his job this time around.

Instead, the Ravens are committing to Harbaugh with two games left in this regular season and another disappointment still possible. It’s not unheard-of for an NFL team to say during a season that a coach’s job is safe, only to reverse course and making a change if things unravel. But in this case, the Ravens took the extra step of issuing a formal announcement and saying a contract extension is being negotiated.

Two NFL head coaches have been fired this season, Hue Jackson by the Cleveland Browns and Mike McCarthy by the Green Bay Packers. It had been believed that Harbaugh, as a former Super Bowl winner, would have been an attractive candidate for other teams if he’d been ousted in Baltimore.

Keeping Harbaugh retains a measure of decision-making continuity for a franchise that has valued such stability. Ozzie Newsome is stepping aside as the Ravens’ general manager after this season and is to be succeeded by his top front office lieutenant, Eric DeCosta.

The Ravens’ success in recent weeks has come with rookie Lamar Jackson having taken over for Joe Flacco at quarterback. Harbaugh stuck with Jackson, selected by Newsome with the final pick in the first round of this year’s NFL draft, as the starter even after Flacco returned from a hip injury, making it a virtual certainty that Flacco won’t remain with the organization beyond this season.

Harbaugh has been flexible to adapt the Ravens’ style of play to accommodate Jackson’s still-developing skill set. They have leaned on their running game, bolstered by Jackson’s improvisational skills, and one of the league’s top defenses while winning four of the five games started by Jackson.

Read more:

Hall of Fame trash talk: Ben Roethlisberger dissed by Saints’ Cameron Jordan ahead of matchup

Derrius Guice rocked a Santa beard and made a bunch of kids’ days on hospital visit

Josh Gordon suspended indefinitely by NFL, leaves Patriots ‘to focus on my mental health’

‘Blood in the water’: Former players worry about the wounded and vulnerable Patriots