It was looking good.

Patriots wide receiver Julian Edelman’s third-down pass on a trick play fell incomplete with 6:04 left in the third quarter Sunday night. The Falcons led by 28-3 at the time and, according to the win probability calculator at Pro Football Reference, there was 99.9 percent chance they’d still be leading when the Super Bowl ended.

Instead, the Falcons collapsed.

A series of mistakes by the Falcons, including curious play-calling decisions and poor clock management, left the door open for quarterback Tom Brady. He led the Patriots to the biggest comeback victory in Super Bowl history.

Here’s how the Falcons went from near-certain Super Bowl winners to historical losers:

Score: Falcons 28, Patriots 3

Time: 6:04 third quarter

Falcons win probability: 99.9 percent

The Patriots, desperately behind, had no choice but to go for it on fourth-and-3. Brady kept the drive alive by completing a 17-yard pass to wide receiver Danny Amendola, who beat nickel back Brian Poole.

After two short gains, the Patriots faced a third-and-8 at the Falcons’ 35-yard line. Brady is 39-years old and slow-footed but he saw an opening when Falcons defensive backs in man-to-man coverage turned their backs to him. Brady ran untouched for 15 yards to the 20-yard line.

Four plays later, Brady threw a short pass to James White, who shakes off a tackle attempt by Jalen Collins and scores the touchdown. Kicker Stephen Gotskowski missed the extra point, however, leaving the Patriots behind 28-9.

Score: Falcons 28, Patriots 9

Time: 2:05 third quarter

Falcons win probability: 99.6

After the Patriots were penalized for illegal touching during an on-side kick attempt, the Falcons had excellent field position at New England’s 41-yard line. Ryan completed a nine-yard pass to Austin Hooper on first down to get well within kicker Matt Bryant’s range.

But officials called a holding penalty on left tackle Jake Matthews on the next play when he grabbed Patriots linebacker Dont’a Hightower. The foul moved the Falcons back to the 42-yard line. After safety Patrick Chung broke up a pass intended for tight end Austin Hooper, the Falcons still had a chance to gain a few yards to set up a Bryant field goal.

The Patriots rushed five defenders against five blockers. Ryan had room to step into the pocket and set his feet but instead drifted backwards, allowing Jabaal Sheard to pressure him from the outside. The pocket collapses as Ryan goes down for the sack and the Falcons end up punting on the first play of the fourth quarter.

Score: Falcons 28, Patriots 9

Time: 14:51 fourth quarter

Falcons win probability: 99.8 percent

New England starts from its 13-yard line after a good punt by Matt Bosher and good coverage. Brady hadn’t been sharp all game as the Falcons harassed him with a strong pass rush but he was steadier in the pocket during this drive and found his rhythm.

Brady completed three passes of 15 yards or longer as the Patriots gained a first-and-goal at the Falcons’ seven-yard line with 12 minutes to play. But two sacks by Falcons defensive tackle Grady Jarrett forced the Patriots to settle for a Gostkowski’s 33-yard field goal with 9:48 left.

Score: Falcons 28, Patriots 12

Time: 9:44 fourth quarter

Falcons win probability: 99.8

The Falcons had a third-and-one at their 36-yard line after two runs by Tevin Coleman. He left the game with an injury and was replaced by Devonta Freeman.

Offensive coordinator Kyle Shanahan opted for a pass by Ryan in the shotgun formation. Patriots linebacker Dont’a Hightower ran past a poor block attempt by Freeman. Ryan shuffled to his left to avoid Hightower but held the ball a split second too long.

Hightower knocked the ball out of Ryan’s hand and the Patriots recovered the fumble—the first turnover by the Falcons during the postseason—at the 25-yard line.

Falcons defensive end Dwight Freeney sacked Brady on first down but he completed passes of four, 12 and eight yards for a second-and-goal at the six-yard line. Brady found Amendola for a TD pass on the next play when he ran a quick out against Jalen Collins and C.J. Goodwin got “picked” by wide receiver Malcolm Mitchell.

With the score 28-18, the Patriots went for the two-point try. Running back James White took a direct snap and barreled into the end zone for the score.

Score: Falcons 28, Patriots 20

Time: 5:56 fourth quarter

Falcons win probability: 97 percent

The Falcons were teetering but they still controlled the game. They started the ensuing drive from their 10-yard line and, on the first play, the Patriots left Freeman uncovered out of the backfield and he caught a short pass from Ryan and dashed for a 39-yard gain.

Two plays later Julio Jones made a sensational catch near the sideline for a 27-yard gain to New England’s 22-yard line with 4:40 to go. Freeman lost a yard on a second-down run but the clock was still running and the Falcons still were well within Bryant’s range.

But they weren’t after Shanahan again called a pass play and Ryan took another sack that pushed the Falcons back to the 35-yard line. Bryant still could make a field goal from there but, on the next play, Matthews got called for another hold. Ryan threw an incomplete pass on third down and the Falcons punted.

Score: Falcons 28, Patriots 20

Time: 3:30 fourth quarter

Falcons win probability: 93.1

Another excellent punt by Bosher pinned the Patriots at their nine-yard line. The Falcons would win if they stopped the Patriots from scoring a touchdown. But their defensive players appeared tired, Brady was sizzling and Patriots fans were roaring.

The Falcons also had some bad luck. Julian Edelman caught a batted pass inches from the turf as it settled on the outstretched leg of Falcons cornerback Robert Alford. The 23-yard gain moved the Patriots to the Falcons’ 41-yard line.

Amendola separated from nickel back Brian Poole on the next play and Brady found him for a 20-yard gain to the 21-yard line. Two completions to White put the Patriots at the one-yard line, and White ran in for a TD.

The Patriots tied the game when Amendola caught a pass and scooted into the end zone as fellow wide receivers Edelman and Chris Hogan cleared out space on another “pick” play.

Score: Falcons 28, Patriots 28

Time: 15:00 overtime

Falcons win probability: 50 percent

It seemed as if the game essentially would come down to the coin flip for overtime possession. The Patriots won the toss, took the ball and went 75 yards in eight plays for the winning TD.

Brady completed five consecutive passes to move the Patriots to the Falcons’ 25-yard line. A pass interference penalty against rookie linebacker De’Vondre Campbell put the ball at the two-yard line. Vic Beasley had a chance to intercept Brady’s throw to Martellus Bennett on the next play but could only knock the ball down.

On second down Brady tossed to White around left end. Safety Ricardo Allen hit White at the two-yard line and Alford came in to help but White powered his way into the end zone and complete the Falcons’ historic collapse.