(CBS) The Chicago Cubs have traded three-time All-Star infielder Starlin Castro to the New York Yankees in exchange for right-hander Adam Warren and a player to be named later, they announced Tuesday evening.

The player to be named later is veteran infielder Brendan Ryan, 670 The Score’s Bruce Levine reported.

READ MORE: Police Officer Responding To Shooting, Struck By Bullet Fired By 15-Year-Old Gunshot Victim

Castro, 25, has spent his entire six-year career with the Cubs. The shortstop/second basemen hit .265 last year with 11 home runs and 69 RBIs in 151 games. He’s a career .281 hitter.

Castro’s been a lightning rod for criticism in recent years, in part because he was prone to losing focus on the field — notably defensively — and also because he slumped at times and didn’t shine quite like he did when he crashed onto the big league scene in 2009, when he hit .300. He followed that up by hitting .307 and leading the National League in hits in 2011.

READ MORE: World's Smallest Flying Structure Developed By Northwestern Engineers

Castro was “sad” to be leaving the Cubs, agent Paul Kinzer told Levine.

The trade of Castro came in conjunction with the Cubs signing utility man Ben Zobrist to a four-year deal. Part of the thinking for the analytical-savvy Cubs with so many power hitters was that they need to have high on-base percentage players in as many spots as possible. Zobrist has a career .355 on-base percentage. Castro’s is .321, and it dipped to .296 in an inconsistent 2015 season in which he was poor for four months and lost his starting shortstop job before settling in at second base and going on a hitting tear late in the season.

Castro has four years and nearly $40 million left on his contract, plus a $16 million team option for 2020. The Yankees will take on the entirety of that money, and Castro will be their everyday second baseman.

MORE NEWS: Ed's Driveway: Volkswagen ID.4

The 28-year-old Warren went 7-7 with a 3.29 ERA last year with the Yankees. He had 43 appearances on the season, 26 in relief and 17 as a starter. Warren has a career 3.39 ERA in a big league career that dates back to 2012. He was a fourth-round pick by the Yankees in the 2009 amateur draft. He went to North Carolina.