Click here if you’re having trouble viewing the photo gallery on a mobile device.

MIAMI GARDENS, Fla. — San Francisco 49ers head coach Kyle Shanahan dared the best player in the NFL to beat him. He did so by being timid and conservative, by being willing to take three points instead of pushing for seven, by choosing to burn clock instead of trying to press his advantage.

And still the 49ers were less than nine minutes away from winning the Super Bowl on Sunday. They led the Kansas City Chiefs 20-10, were dominating on both offense and defense, and had the ball with less than nine minutes to play in the fourth quarter.

They subsequently collapsed in a dramatic and comprehensive fashion.

Shanahan and the 49ers gave Chiefs quarterback Patrick Mahomes an inch. He took so much more — he took away San Francisco’s sixth Super Bowl title, their first in 25 years and gave Kansas City its first in 50 years with a 31-20 win.

The 49ers’ head coach came to the Super Bowl with the goal of changing his legacy. Despite being the most brilliant offensive mind in the NFL and one of the league’s best head coaches, young or old, Shanahan is best known for “28-3” — the lead the Atlanta Falcons had over the New England Patriots three years ago in Super Bowl LI.

The Falcons lost that game. And Shanahan, then the Falcons’ offensive coordinator, has been handed the majority of the blame.

Sunday’s 20-10 scoreline won’t be emblazoned on t-shirts, but the loss should be worn by the 49ers’ head coach.

Maybe it’s just bad luck, and, of course, it isn’t all on the coach. He only calls the plays, the players must execute. His quarterback, Jimmy Garoppolo, was flustered in the fourth quarter behind an offensive line that broke down. The Niners’ defense, which had been controlling the game, shattered.

But Shanahan is the common denominator of two of the most stunning fourth-quarter collapses in Super Bowl history.

In Shanahan’s seven fourth-quarter drives as a Super Bowl play-caller, his offenses have yet to score a point. After going three quarters without punting, the 49ers were forced to do so on their first two possessions of the fourth quarter. The Chiefs took the ball 80 yards the first time and 65 the second time to turn a 20-10 deficit into a 24-20 lead.

And still, San Francisco had a chance to win the game. They had the ball, down four, with 2:44 to play. Starting at their own 15, they got to the Chiefs’ 49, where four consecutive passing plays failed. The Chiefs took over on downs and broke off a 38-yard touchdown run to end things once and for all.

“We didn’t take our opportunities,” tight end George Kittle said. “I could give you every cliche in the book — we just didn’t get it done.”

Shanahan’s play-calling in the fourth quarter will surely be parsed, dissected, and criticized by 49ers fans for years to come. But it was his larger choices that will loom ever larger as time goes on. Twice he chose to kick field goals instead of trying to convert reasonable fourth downs. Then he chose to waste a possession at the end of the first half.

When the Chiefs failed on a third-and-long with 1:53 remaining in the second quarter of a 10-10 game. Shanahan, with three timeouts at his dispoal, didn’t use any of them. He let the clock run.

As a result, the 49ers didn’t run a play until there were 59 seconds remaining in the half.

Giving Shanahan the benefit of the doubt, the 49ers had poor field position, and the Chiefs had three timeouts and the most dangerous quarterback in the NFL. By letting the clock run, Shanahan was ensuring that Mahomes wouldn’t touch the ball again in the first half.

But the downside was obvious: any chance of the 49ers scoring was significantly limited by the lack of time on the clock. It was later eliminated by Kittle’s offensive pass interference on a 42-yard catch with six seconds remaining in the half. While replays showed that Kittle did push off on the play, the call was unquestionably pedantic.

“We should have gotten points,” Shanahan said of the drive.

And while the penalty ensured that they wouldn’t get point, it was Shanahan’s decision that set the stage for that failing.

Shanahan sent a message with that decision, an unmistakable one: he was scared.

And while there was good reason to be, as was proven in the fourth quarter, you simply cannot win a Super Bowl that way. That was proven too.