NICE, France (AP) Former Arsenal captain Patrick Vieira was hired as manager of the French club Nice on Monday after leaving as coach of New York City FC.

Vieira replaces Lucien Favre at Nice. New York City FC said Domenec Torrent will succeed Vieira at the Major League Soccer club. Torrent will begin in New York once his U.S. work permit is approved.

Vieira had been linked with the Arsenal job after Arsene Wenger stepped down last month but will now return to his native France for his first coaching job in Europe.

"After two and a half years as head coach of NYCFC, today will be my last day," Vieira wrote on Twitter. "I can honestly say that my time with the club has been absolutely perfect - both on the professional and personal level."

Vieira led New York City to two consecutive playoff appearances and leaves with the team in second place in the Eastern Conference.

Nice President Jean-Pierre Rivere said the team was looking for a coach with the "ability to continue to produce attractive football, to bring through youngsters by taking risks to help them grow, and someone who lives and breathes to win."

As a player, Vieira also had stints at Juventus, Inter Milan and Manchester City, but is best known for spending nearly a decade at Arsenal and being a key part of Wenger's title-winning teams. He was captain of the team that went undefeated in winning the 2003-04 Premier League title.

But as a coach he has only been part of the City Football Group - which owns both the Manchester and New York clubs. He started as a coach of Manchester City's development squad before getting his first head coaching position in New York.

New York City FC said in a statement that assistant coach Christian Lattanzio, performance coach Kristian Wilson and physical performance coach Matt Cook were also leaving to join Vieira's staff at Nice. The new staff additions will be announced soon.

"Patrick has been a fantastic role model at NYCFC and a true leader on and off the field. We know that leaving the club has been a difficult decision for him, but we understand his choice to return to Europe where he spent his whole playing career," team vice chairman Marty Edelman said.

"Patrick leaves us in great shape to continue our encouraging campaign, and our goals for the season remain the same. We have the most talented and balanced roster of players since the club was formed."

Torrent, former coach of Girona and assistant coach at Barcelona and Bayern Munich, comes to New York from sister club Manchester City, where he was an assistant to Pep Guardiola. His contract runs until the end of the 2020 season.

"I really couldn't have hoped for a better opportunity than at this football club," said Torrent, who has been with Guardiola the past 11 years. "I know we have a very talented team."

Edelman was pleased to move so quickly to replace Vieira.

"A smooth transition was certainly a priority, particularly for a group of players who have had an excellent campaign so far," he said. "I know Domenec can't wait to get started."

After Guardiola became Barcelona's coach, he brought Torrent with him and they enjoyed great success. In four seasons, Barcelona won three La Liga titles, two UEFA Champions League trophies, two UEFA Super Cups, two Spanish Cups, three Spanish Super Cups and two FIFA Club World Cups.