In a stunning turn of events, free agent Carlos Correa is headed to the New York Mets — and not the San Francisco Giants.

The 28-year-old shortstop agreed to terms on a 12-year, $315 million deal with New York — a week after coming to terms with the Giants on a historic 13-year, $350 million contract.

How did this extraordinary change of course take place? What went wrong between the Correa and the Giants? And has anything like this ever happened in MLB free agency? Here’s everything you need to know about the shocking switch and what this means for Correa, the Mets, the Giants and beyond.

Wait … what happened?!

The Giants’ contract with the star shortstop fell apart after the team expressed concerns during the physical examination, prompting Correa to reopen his free agency and sign in the middle of the night with the Mets.

Before Correa agreed to terms with the Giants, the Mets had made an 11th-hour run at signing him. The deal did not come to fruition then. A week later, the most astonishing move of the offseason is one passed physical from becoming a reality (a caveat with particular import to this contract).

It’s a staggering outcome that continues to reshape the baseball landscape this offseason — and would make the Mets the most expensive team in North American sports history.

Didn’t the Mets already spend a whole bunch of money this offseason? And don’t they already have a shortstop?!

Sure do. Last year, Mets owner Steve Cohen signed Francisco Lindor to a 10-year, $341 million deal after trading for the star shortstop in 2020. Correa is expected to move to third base in New York to play alongside his friend and Team Puerto Rico teammate Lindor.

And speaking of Steve Cohen … when Cohen bought the Mets in November 2020, there was a belief around baseball that he could upend the system with his wealth. But this exceeds the expectations of even the most hopeful Mets fan. If Correa’s deal is completed, the team’s estimated payroll will be around $384 million. Based on that number, the Mets would owe an additional $111 million in luxury tax payments. Their total payroll, as of now, is expected to be just shy of $500 million. In baseball history, no team has come within $150 million of that number.

Just this offseason, the Mets are adding Correa to a list of signings that includes starters Justin Verlander, Kodai Senga and Jose Quintana along with the re-signings of outfielder Brandon Nimmo and relievers Edwin Diaz and Adam Ottavino. Add in catcher Omar Narvaez and reliever David Robertson, and the Mets’ total outlay this winter is $806.1 million.

Correa had “agreed to terms” with the Giants. What does that phrase actually mean in free agency?

When a player and team agree to terms, they strike a deal on contract details: years, dollars, performance bonuses, opt-outs, no-trade clauses and other financial levers. A team sends a term sheet to a player, and the player signs it. But that agreed-upon contract is not official until a player passes a medical examination, which includes an MRI, blood work and other general health tests. While it’s rare, teams do occasionally flag a player’s medicals, which allows for two outcomes: a renegotiation of the deal or it being scrapped altogether. Here, the latter occurred.

Were other teams still allowed to talk with Correa? When could the Mets have started renegotiating?

This is something of a gray area. Technically, when the physical process starts, the deal is out of a player’s hands. Two scenarios can squelch it: the team failing the player on the physical, or Major League Baseball declining to approve the contract. Players and agents do not continue talking with other teams, post-agreement, because they don’t want to suggest the deal is in jeopardy, lest it be pulled off the table, and the agent does not want to earn a reputation as someone who renounces agreements for no good reason. Would that run afoul of the rules, though? That’s unclear; no player is known to have tried.

What’s obvious is that the Giants’ concerns were serious enough that Correa and his agent, Scott Boras, worried the deal with San Francisco was in peril, and the negotiations with the Mets resumed Tuesday and accelerated rapidly.

Do we know what the Giants saw in Correa’s physical? And should the Mets be concerned?

The specific nature of the Giants’ concerns with Correa is unclear. But with a deal as long and lucrative as the one to which he had agreed, any team approaches a physical with greater rigor.

As for the Mets: Every team has different thresholds for giving a thumbs-up on players’ medicals. But, after the events of the past 24 hours, it’s extremely unlikely that Correa would come to terms with the Mets without the team indicating that it expected to pass him and make the deal official.

Has anything like this ever happened in MLB before?

Nothing of this magnitude, no.

Differences of opinions on medical information aren’t infrequent, but they tend to be more with draft-eligible players. Perhaps the most famous is right-hander Kumar Rocker, who went to the Mets with the 10th pick of the 2021 draft. They had agreed on a $6 million deal before the draft, but the Mets did not offer him a contract. Rocker was taken third overall by the Texas Rangers in the 2022 draft and signed for $5.2 million.

The closest analog to Correa in the last decade is Grant Balfour, the veteran reliever who agreed to a two-year, $15 million deal with Baltimore in 2013. The Orioles — who were widely seen throughout the industry as having the most difficult-to-pass medical process — failed Balfour. He eventually signed with Tampa Bay for two years and $12 million.

What can the Giants do from here?

Unfortunately for them, there’s not much left to do. They went hard after Aaron Judge, only to see him re-sign with the New York Yankees. They then poached the best player left in free agency, Correa — only for this to happen.

The best free agent still available is 32-year-old right-hander Nathan Eovaldi, but the Giants already have seven starting pitchers. The best position player left is outfielder Michael Conforto, who didn’t play last season with a shoulder injury.

The real answer: Even after signing outfielders Mitch Haniger and Joc Pederson as well as starters Ross Stripling and Sean Manaea, this is likely to end up a lost offseason for the Giants, who went into the winter hoping to land a franchise player and will likely exit it empty-handed.