SAN FRANCISCO (AP) — The San Francisco Giants have hired manager Bob Melvin away from the division rival San Diego Padres, three people with direct knowledge of the agreement said Tuesday.

The people spoke to The Associated Press on condition of anonymity because neither team had made a formal announcement of Melvin’s hiring — which was likely to be official by late Tuesday night. The Athletic first reported Melvin was the Giants’ choice.

The 61-year-old Melvin will be returning to the Bay Area where he grew up, cheered for and later played for the Giants and then managed the Oakland Athletics from 2011-21. An introductory news conference is planned for Wednesday.

Melvin had one year left on his contract with San Diego but leaves amid reports of friction with general manager A.J. Preller. Melvin managed the Padres for two seasons, reaching the 2022 NL Championship Series but then missing the playoffs this season with a $258 million payroll, the third-highest in the majors. It’s unclear if the Padres will receive compensation.

Melvin, a three-time Manager of the Year who won in both leagues, went 171-153 with the big-spending Padres and will enter his 21st season as a manager next year. He has a career record of 1,517-1,425 with eight postseason appearances while guiding Arizona, Seattle, Oakland and San Diego.

A native of nearby Palo Alto, California, Melvin loves the Bay Area. He attended the University of California-Berkeley and played for his hometown Giants from 1986-88.

Giants President of Baseball Operations Farhan Zaidi had hoped to find a new manager by the start of free agency to replace Gabe Kapler, fired with three days remaining in the season. Kapler was 295-248 over three-plus seasons, leading the to a franchise-record 107 wins to edge the 106-win Dodgers for the NL West title in 2021 before missing the playoffs the last two seasons.

___

AP Sports Writer Bernie Wilson in San Diego contributed to this report.