The San Diego Padres have agreed to a four-year, $20 million deal with right-hander Nick Martinez, according to sources.

Martinez's deal includes opt-outs after his first and second year.

The 31-year-old spent the past four seasons in Japan. He previously played four seasons in the Major Leagues, all with the Texas Rangers from 2014-17, and went 17-30 with a 4.77 ERA.