The Washington Nationals agreed to trade stars Max Scherzer and Trea Turner to the Los Angeles Dodgers on Thursday night, according to multiple people with knowledge of the situation, dramatically altering their roster while signaling a rebuild just two years after they won the World Series.

After fielding a contender for a decade and building for another playoff run this season, the Nationals will instead fuel the Dodgers’ quest for back-to-back championships and try to restock their thin farm system. As of late Thursday, the trade was agreed upon but pending medical reviews for all players involved.

The deal, expected to be completed before Friday’s 4 p.m. Major League Baseball trade deadline, takes two more title-winning cornerstones out of Washington. Also gone are Anthony Rendon, Howie Kendrick, Sean Doolittle and Adam Eaton, among others. Stephen Strasburg underwent season-ending surgery this week. They all celebrated a title in Houston less than two years ago yet are scattered around the majors, in retirement or, for Strasburg, facing a second months-long recovery in as many seasons. The club’s entire makeup has shifted to a new era with reworked goals.

In return, the Dodgers will send the Nationals four prospects: catcher Keibert Ruiz, right-handed pitcher Josiah Gray, right-handed pitcher Gerardo Carrillo and outfielder Donovan Casey, according to people with knowledge of the situation. Ruiz and Gray were among the top talent in their system. Los Angeles will also take on money owed to Scherzer and Turner, according to two people with knowledge of the terms, which potentially lessened what the Nationals received for a pair of all-stars. Washington split a doubleheader against the Philadelphia Phillies on Thursday and trails the New York Mets by 7½ games in the National League East.

“I’d rather look at this as a positive thing,” Scherzer said after throwing six strong innings against the Phillies on Thursday, his departure a foregone conclusion. “I mean, look, I signed a seven-year deal, and we won a World Series. The first thing I said when I signed was that I’m here to win, and we won. We won a World Series. That’s a lifelong dream come true and something that I’ll always be so proud of with these guys here.”

By trading Scherzer and Turner — their longtime ace and a premier shortstop in his prime — the Nationals are set to retool around outfielder Juan Soto and their newest additions. The immediate price of that will be watching Scherzer and Turner, who is in MLB’s coronavirus protocols after testing positive Tuesday, hunt another title with another team. And the team on the field will be different, younger, the sort Washington hasn’t seen since becoming a perennial contender in 2012. The plan of playing deep into a future October won’t necessarily waver. But without Scherzer and Turner, the organization’s identity will change.

On the afternoon of July 20, General Manager Mike Rizzo described a “dual path” for the deadline: He planned to lay groundwork to buy or sell. If the Nationals won or floated in the standings, they would have added to their roster, perhaps shopping for a reliever or middle-of-the-order bat. But they instead lost five straight to the Miami Marlins, Baltimore Orioles and Philadelphia Phillies. Their fate was sealed. They only considered dealing Scherzer and Turner — and closer Brad Hand earlier Thursday — because they saw no shot in a middling division.

And here’s a long-known fact about Rizzo: When he does something, he does it all the way. Scherzer, who turned 37 on Tuesday, is in the final season of a seven-year, $210 million contract, making him the most attractive rental on the market. Turner, on the other hand, was not a trade candidate until the season totally cratered. On multiple occasions across the past two years, the Nationals tried to sign Turner to a long-term extension, viewing him as their shortstop of the present and future.

But they couldn’t agree on terms, getting Turner to within a year and two months of free agency. With Corey Seager returning to the Dodgers this week, it is likely that Turner will be asked to play second base, a position where he has started just 31 games in his career.

The centerpiece of the Nationals’ haul is Ruiz, a 23-year-old catcher ranked by most lists among the game’s top 20 prospects. He was hitting .311 with a 1.012 on-base-plus-slugging percentage for Class AAA Oklahoma City. Ruiz was expected to be a part of any major deal, in large part because he was blocked by Dodgers star Will Smith — only slightly older.

Gray is another high-end prospect, ranked 59th on Baseball America’s list. He did somewhat fall in the Dodgers’ estimation this season and has been dealing with a shoulder issue that has limited him to fewer than 25 innings between the minors and majors. But he had a 2.87 ERA in 15⅔ innings with Oklahoma City, and allowed six runs on seven hits in eight big league innings this year. Before this season, Gray had never pitched to an ERA above 2.75 since beginning his professional career in 2018.

Carrillo and Casey, by contrast, are further away from contributing at the big league level. But whenever a team trades stars for prospects, there is some period of waiting and hoping. The Nationals and their fans are not used to that feeling and are usually on the other end of this very transaction. The swap just shows how much has changed.

Chelsea Janes contributed to this report.