DERBY, England — Wayne Rooney will be leaving Major League Soccer after less than two seasons to return to play in England and be closer to his family.

The 33-year-old former England captain will remain at D.C. United until the end of the season before joining second-tier Championship team Derby County as player-coach from January.

Rooney has signed an 18-month contract that can be extended until the end of the 2021-22 season.

”I am very excited about the opportunity that Derby County have provided me with,” Rooney said. “I am sure I can make a big contribution and can’t wait to meet everyone, especially the supporters. I am equally excited to begin my coaching career at Derby County working with both the first team and academy.”

Rooney, who is the record goal scorer for Manchester United and England, had another two years remaining on the contract he signed with D.C. United after joining from Everton in 2018.

”After speaking to Wayne and understanding his difficult situation of being so far away from his family, we have accepted that this is the best decision for all parties,” said D.C. United co-chairmen Steve Kaplan and Jason Levien. “Wayne is an exceptional leader and one of the most iconic players to play the game, so we look forward to his continued contributions to the team this season.”

The Washington-based team remains in contention for the MLS playoffs, so the striker’s stay in the United States could end in November.

”I must also take this opportunity to thank D.C. United, their owners, executives and supporters who have been superb to work with,” Rooney said. “I want them to know that I will give my all in support of our push for the playoffs.”

Derby has been out of the Premier League since 2008 and lost a playoff final in May to return to the top division. Rooney’s former England teammate, Frank Lampard, was in charge of Derby last season before moving to manage Chelsea.

”Wayne Rooney is an extremely talented and top-class footballer,” said Phillip Cocu, who succeeded Lampard as Derby manager. “He has enjoyed a wonderful career, both in club football and for England, and he still has so much to give as well.

”His credentials speak for themselves. But to have a player with his leadership, skill, experience, character and work ethic will be huge for us. He knows what it takes to succeed as a player and I have no doubt he will have a positive impact right across the club. The inspiration and motivation this can generate is massive for all of our players from the first team right through to the youngsters in the Academy. It is entirely in keeping with, and in support of, the club’s philosophy and approach.”