Dwayne De Rosario — here playing for his native Canada — is a five-time MLS all-star and will be joined D.C. United. Dax McCarty goes to the New York Red Bulls in the trade. (STAN HONDA/AFP/Getty Images)

D.C. United acquired five-time all-star Dwayne De Rosario from the New York Red Bulls for midfielder Dax McCarty on Monday night, a blockbuster trade that drastically altered United’s attack heading into the second half of the MLS season.

De Rosario, 33, is one of the most decorated players in league history: four MLS Cup titles, two MLS Cup most valuable player awards and five Best XI all-league selections. Since joining the league 10 years ago, the Canadian national team veteran has scored 80 goals — tied for 10th — in 256 regular season appearances for the San Jose Earthquakes, Houston Dynamo, Toronto FC and New York.

“DeRo is the real deal,” Coach Ben Olsen said. “He’s as good as this league has ever seen.”

United first inquired about De Rosario last year, and after the midfielder-forward was dealt to the Red Bulls from Toronto early this season, General Manager Dave Kasper said he reached out to his New York counterpart, Erik Soler, about a month ago. The sides agreed to resume talks after De Rosario’s return from Canada duty at the just-completed CONCACAF Gold Cup.

“He gives us a great attacking option,” Kasper said. “It enables [Olsen] to put together a good group of attacking players. How it works out remains to be seen, but as of today, we have a nice addition to our lineup.”

Like De Rosario, McCarty is leaving a team with which he spent less than one season. Acquired from the expansion Portland Timbers for defender Rodney Wallace and a fourth-round draft pick in the winter, the 24-year-old central midfielder was a key piece to Olsen’s rebuilding efforts and was named team captain.

But he never seemed fully comfortable in United’s system, which required more attacking responsibilities than he had while with FC Dallas last year. McCarty appeared in 13 of 15 league matches, missing two games with a groin injury, and had two assists but just one shot on goal.

“It was a new position,” Olsen said. “He had a little trouble adapting to the way we play. It was below our expectations and below his expectations.”

De Rosario is due to earn $493,750 this year, making him the highest-paid player on United’s active roster, by a large margin. (Midfielder Branko Boskovic is making $525,366 but is sidelined for several months with a torn knee ligament.) McCarty’s salary is $195,000.

However, a source familiar with the trade said a portion of De Rosario’s salary remains on Toronto’s books, stemming from his move to New York in April.

United cleared salary cap space last week by agreeing to transfer Brazilian midfielder Fred ($157,750) to Australian club Melbourne Heart when the international signing period opens in mid-July.

Led by Charlie Davies, Chris Pontius and Josh Wolff, United’s attack has shown marked improvement since last year’s woeful scoring output (21 goals in 30 matches, an MLS record low). But the club (4-5-6, fifth place in the Eastern Conference) lacked a dynamic presence in central midfield and didn’t seem dangerous enough to end a three-year playoff rut.

De Rosario had two goals and four assists in 13 league matches for the Red Bulls. In 57 appearances over two-plus seasons with Toronto, he tallied 27 goals and 10 assists.

De Rosario and McCarty will face their former clubs July 9 when United plays New York at Red Bull Arena.

Earlier Monday, United reinforced an injury-weakened back line by acquiring fourth-year pro Brandon McDonald from the San Jose Earthquakes for financial considerations. McDonald, 25, can play central defense and defensive midfield.

Dejan Jakovic and Marc Burch are out with hamstring injuries. Devon McTavish is sidelined by concussion issues and Rodrigo Brasesco was waived this month.