After seven years with the New York Yankees, free-agent right-hander Masahiro Tanaka declared Thursday that he will return to Japan to pitch for the Rakuten Golden Eagles from the Nippon Professional Baseball League.

“I have chosen to return to Japan and play with an Rakuten Eagles for the 2021 season,” Tanaka composed on Twitter. “I wanted to make sure and touch base with you, and thank you for all of the love and support you’ve given me for the last 7 seasons.

“I feel extremely fortunate for having the chance to take the field as a member of the New York Yankees, and perform before you passionate fans. It’s been an honour and a privilege!

Tanaka, 32, coming off a year where he missed a while after being struck in the head by teammate Giancarlo Stanton’s shot during live batting practice, only finished a seven-year, $155 million deal.

A two-time All-Star selection, Tanaka spent seven of his MLB seasons as a Yankees newcomer from 2014 to 2020 and has been one of the most persistent starting pitchers in the majors over that period, moving 78-46 in 173 starts.

He posted a 3-3 record with a 3.56 ERA — down from 4.45 in 2019 — in 10 starts during the pandemic-shortened 2020 season.

Tanaka was found to have a partially torn ligament in his pitching elbow throughout the 2014 season, and after that, the Yankees attempted to give him extra rest between begins occasionally. He made a $22 million base wages in both the 2018 and 2019 seasons and $23 million in 2020.

He pitched well in the playoffs during his period at the Bronx, going 5-4 with a 4.18 ERA, 44 strikeouts and 15 walks in 10 starts and 54 innings. He had his best postseason run in 2017, when he went 2-1 with a 0.90 ERA, 18 strikeouts and three walks in 20 innings throughout the division series against Cleveland and American League Championship Series versus Houston.

Before joining the Yankees, Tanaka was 99-35 using a 2.30 ERA in seven seasons with the Rakuten Golden Eagles, striking out 1,238 in 1,315 innings.