Josh McDaniels decided Tuesday to remain with the Patriots instead of leaving to become head coach of the Colts. (Kevin C. Cox/Getty Images)

Josh McDaniels, the offensive coordinator who helped the New England Patriots to their third Super Bowl appearance in four years, decided Tuesday to remain with the Patriots rather than proceed with his plan to become head coach of the Indianapolis Colts.

McDaniels’s decision was confirmed by multiple people familiar with the situation and then announced publicly by the Colts.

“After agreeing to contract terms to become the Indianapolis Colts’ new head coach, New England Patriots assistant coach Josh McDaniels this evening informed us that he would not be joining our team,” the Colts said in a written statement released Tuesday night. “Although we are surprised and disappointed, we will resume our head coaching search immediately and find the right fit to lead our team and organization on and off the field.”

It is not believed, according to those people with knowledge of the deliberations, that McDaniels was promised that he will be Bill Belichick’s successor as the Patriots’ head coach. However, Patriots owner Robert Kraft has said in the past that McDaniels would be a strong candidate to succeed Belichick when Belichick is done coaching the team.

The Colts had announced earlier Tuesday that McDaniels agreed to contract terms to be their head coach. They scheduled his introductory news conference for Wednesday. McDaniels even had hired some assistant coaches.

Instead, the Colts are left scrambling to find a new head coach, with other coaching staffs around the league already set. They had conducted two formal interviews with McDaniels and waited until after the Patriots’ appearance in the Super Bowl to officially hire him.

The Patriots lost, 41-33, in Super Bowl LII on Sunday in Minneapolis. Their defensive coordinator, Matt Patricia, left Monday to become head coach of the Detroit Lions.

McDaniels’s decision to stay was first reported Tuesday night by ESPN after Pro Football Talk reported Sunday that McDaniels was giving serious consideration to remaining with the Patriots, regardless of whether Belichick decided to retire after Sunday’s game.

Belichick is said to be under contract next season with the Patriots. Those familiar with the McDaniels situation said Tuesday night they believe that Belichick, who turns 66 in April, plans to coach the Patriots next season.

McDaniels was the head coach of the Denver Broncos in 2009 and 2010 and, after rehabilitating his coaching reputation around the league in recent years in his second stint on Belichick’s staff in New England, he expressed interest in being a head coach again. But he had been selective about which head coaching opportunity to choose, wanting to make sure he would succeed this time. He had gone through the interviewing process in previous hiring cycles but withdrew from consideration of any job.

This time, he seemed set to move forward. He declined to confirm in the days leading up to the Super Bowl that he was headed to Indianapolis, saying he was focused on Sunday’s game. But he spoke like someone who was on his way to his next head coaching chance.

“My job is [to] try to be the best I can at the job that I have, and then make the right decision for my family,” McDaniels said on Super Bowl media night. “I’ve got a beautiful wife and four great kids. I just want to make sure they’re blessed with whatever decisions that we’re fortunate to have an opportunity to make. And if that means that I get an opportunity to do that, then I’d be really happy to do that at some point. But right now this week is special for one reason. And that’s because we’re here having an opportunity to compete against the Eagles for the Super Bowl championship.”

McDaniels’s abrupt reversal, combined with his failure in Denver, likely will leave other NFL teams wary to deal with him in the future, meaning he probably will have little choice but to stay put in New England as the apparent coach-in-waiting behind Belichick.

Kraft, in a February 2017 interview with The Washington Post, called McDaniels a strong candidate to be the Patriots’ next head coach whenever Belichick is done.

“He’s a terrifically skilled and gifted coach,” Kraft said then. “He’s very special and we like having him in our system. He’s definitely a serious candidate if he’s still with us, which I hope he is.”

The Patriots are said to have pushed hard for McDaniels to remain in New England. It is believed that he was given an upgraded contract.

McDaniels’s decision was not embraced by all of those around him. There were those among his associates who believed he should have honored his commitment to the Colts, according to one person close to the situation.

The relationship between the Patriots and Colts organizations had been strained since Indianapolis lost at New England in the AFC championship game to close the 2014 season. That was the game that sparked the Deflategate controversy. Ryan Grigson, then the general manager of the Colts, reportedly had asked league officials to look into the possibility that the Patriots were using improperly under-inflated footballs while on offense.

Chris Ballard reportedly has worked to repair the Colts’ relationship with the Patriots since succeeding Grigson as the GM in Indianapolis. But now the Colts, with McDaniels’s change of heart, are in a difficult spot. Two of their other original head coaching candidates, Matt Nagy and Mike Vrabel, already have accepted head coaching jobs elsewhere — Nagy with the Chicago Bears and Vrabel with the Tennessee Titans.

There was speculation Tuesday night that the Colts’ new set of candidates could include Kansas City Chiefs special teams coordinator Dave Toub and Buffalo Bills defensive coordinator Leslie Frazier. The Eagles also have a trio of respected assistant coaches in offensive coordinator Frank Reich, quarterbacks coach John DeFilippo and defensive coordinator Jim Schwartz.

McDaniels had begun to put his coaching staff in place, a group that was to include Dallas Cowboys linebackers coach Matt Eberflus as his defensive coordinator. There were reports Tuesday night that Eberflus, along with new offensive line coach Dave DeGuglielmo and defensive line coach Mike Phair, have contracts with the Colts and will be given the chance to remain in the organization.

It is unclear if McDaniels had any concern about the progress of Colts quarterback Andrew Luck in his return from shoulder surgery. Luck missed all of the 2017 season.

Read more from The Post:

Someone broke into Rob Gronkowski’s house while he was at the Super Bowl

It’s too early to say the Patriots’ dynasty is over, but the end is near

‘I’m not a loser anymore’: Eagles’ Super Bowl celebration brings catharsis amid some chaos

Kevin Hart got drunk, tried to crash the Eagles’ Super Bowl celebration and cursed on NFL Network

Malcolm Butler denies participating in ‘ridiculous activities’ before Super Bowl