John Herdman is leaving Canada Soccer to coach Toronto FC, the federation announced on Monday.
Herdman, the 48-year-old from England, recently guided the Canadian men to their first World Cup appearance since 1986.
He previously coached the Canadian women to bronze medals at the 2012 and 2016 Olympics.
Herdman first made the move to Canada in 2011 after coaching in New Zealand.
"I am grateful for the incredible opportunity to have represented Canada for the past 12 years, for the moments I've been able to share with the players, the staff, and the supporters," he said. "The goal was always to leave the game in a better place and I'm confident that goal has been achieved for Canada."
Canada Soccer said that Montreal's Mauro Biello, an assistant under Herdman since 2018, would take over as head coach on an interim basis. It said the search for a new manager would begin immediately. Under Herdman, Canada's women achieved their first top-four ranking and set records for most goals and wins in a season in 2016.
The Canadian men scored their first-ever World Cup goal under Herdman's guidance while moving into FIFA's top 30 for the first time.
President Charmaine Crooks called Herdman "the most successful head coach in the history of Canada Soccer.
"We would like to thank John for his immense contribution to the game in Canada and wish him the very best in his new role at Toronto FC," Crooks said.
Herdman said then he hoped to stay through the 2026 World Cup, which Canada will co-host, but in June he said the Canada Soccer Association needed to increase the team's funding.
Toronto FC fired Bob Bradley on June 26 and made Terry Dunfield its interim coach. Toronto has 19 points, tied for the lowest in the 29-team league, with three wins, 13 losses and 10 ties.
"It's the right time for me to step into a new challenge in my career, and the structure of a club environment is a context I've aspired to operate in," Herdman said in a statement released by Toronto. "Having access to connect and collaborate with the staff and players daily allows for a different depth of development and connection, both on and off the pitch."
Assistants Simon Eaddy and Eric Tenllado, lead scout Alex Dodgshon and head of performance Dr. Cesar Meylan are departing Canada Soccer alongside Herdman.
"Having worked closely with these individuals behind the scenes, I have experienced first-hand the value they have brought to Canada Soccer. I want to thank them for the countless hours they have given to Canada Soccer and wish them all the best in their new endeavours," said interim general secretary Jason deVos.