NEW YORK (AP)Buck Showalter is back on the bench in New York.

Nearly 30 years since making his name in pinstripes, Showalter has been hired as manager of the Mets as he returns to the Big Apple to take over his fifth major league team.

The former New York Yankees skipper replaces Luis Rojas, let go in early October following two losing seasons. Mets owner Steve Cohen announced the move Saturday afternoonon Twitter.

Showalter received a three-year contract, according to a person familiar with the deal. The person spoke to The Associated Press on condition of anonymity because the length of the agreement had not been announced.

An official announcement from the club is expected in the next few days.

Showalter has managed more than 3,000 big league games over 20 seasons, giving the Mets an experienced bench boss for the first time since Terry Collins’ seven-year tenure ended after the 2017 campaign.

New York has been searching for solid leadership ever since – in the dugout and the front office.

Showalter certainly carries credibility, with a long history of turning around losing teams. No doubt that made him an attractive candidate to new Mets general manager Billy Eppler and the aggressive Cohen, who is spending freely on players and eager to win quickly since buying the bungling franchise in November 2020.

Houston bench coach Joe Espada and Tampa Bay bench coach Matt Quatraro were the other finalists for the job. Neither has any major league managing experience, and Showalter was thought to be the frontrunner all along.

Each of the three met separately with Cohen in person this past week during a second round of interviews.

New York also interviewed former Tigers and Angels manager Brad Ausmus as well as ex-Oakland manager and current Dodgers bench coach Bob Geren, who was the Mets’ bench coach under Collins when they reached the 2015 World Series.

The 65-year-old Showalter joins Hall of Famers Casey Stengel, Yogi Berra and Joe Torre as managers of both the Mets and Yankees. Dallas Green held both jobs as well.

In addition to building a winner across town during the 1990s with the Yankees, Showalter has managed the Arizona Diamondbacks, Texas Rangers and Baltimore Orioles. He compiled a regular-season record of 1,551-1,517-1 (.506 winning percentage) from 1992-2018, winning three AL Manager of the Year awards and taking all his teams besides Texas to the playoffs at least once.

The Yankees (1996) and Diamondbacks (2001) both won the World Series in the first season after Showalter left. He led Arizona to 100 wins in 1999 before losing a playoff series to the Mets.

His most recent managerial gig came with Baltimore, where he spent eight-plus seasons from 2010-18. Showalter guided the Orioles to three playoff appearances, one division title and a berth in the 2014 AL Championship Series, where they were swept by Kansas City.

He was heavily criticized, however, for leaving dominant closer Zack Britton in the bullpen during the 2016 AL wild-card game, which the Orioles lost 5-2 in Toronto on Edwin Encarnacion’s three-run homer off Ubaldo Jimenez in the bottom of the 11th inning.

Baltimore also finished last in the AL East three times during Showalter’s eight full seasons, including his final two. He was replaced by Brandon Hyde following a 47-115 debacle in 2018 as the Orioles overhauled baseball operations and embarked on a full rebuild.

Since then, Showalter has worked as an MLB Network analyst and on Yankees broadcasts with YES. Previously, he had a similar role at ESPN.

Wired tight but with a sense of humor, Showalter is well-known for his baseball acumen, dogged preparedness and meticulous attention to detail. He’s already at ease in New York’s large and pressurized media market, with relationships that go back decades to his time managing the Yankees.

The Mets declined their 2022 option on Rojas’ contract Oct. 4, a day after they finished 77-85 and third in the NL East following a second-half meltdown.

They hired Eppler last month following a long search for someone to lead baseball operations under team president Sandy Alderson, and moved fast to sign four free agents for a total of $254.5 million: ace pitcher Max Scherzer ($130 million over three years), center fielder Starling Marte ($78 million over four years), outfielder Mark Canha ($26.5 million over two years) and All-Star infielder Eduardo Escobar ($20 million over two years).

The deals were completed in the days just before baseball’s labor contract expired Dec. 1, leading to a lockout that halted transactions and froze big league rosters.

That allowed Eppler – who also spent years with the Yankees, although not until after Showalter’s tenure ended – to finally turn his attention to finding a manager. Showalter becomes the fifth for the Mets in just more than four years.

Mickey Callaway replaced Collins and lasted two seasons. Rojas was swiftly promoted to skipper when Carlos Beltran was let go in January 2020 without managing a single game – fallout from the Astros’ 2017 sign-stealing scandal.

None of those three had managed in the majors before. Beltran still hasn’t. Rojas was hired by the Yankees last month to coach third base.

Now, it is Showalter’s turn as he takes over a Mets team that’s endured four losing seasons in five years and 10 in the past 13. New York has made the playoffs twice in the last 15 seasons, advancing only in 2015.

Showalter, who has never won a pennant, will need to fill out his coaching staff. The Mets announced in October that Jeremy Hefner will return as pitching coach next year, but the other coaches are expected to be replaced.

More AP MLB coverage: https://apnews.com/hub/MLB and https://twitter.com/AP-Sports