LOS ANGELES — The San Diego Padres released veteran shortstop Alexei Ramirez before Sunday’s game against the Los Angeles Dodgers.

Ramirez, who turns 35 on Sept. 22, hit .240 with five homers and 41 RBIs in 128 games with San Diego this year, starting 109 games at shortstop, three in right field and one at designated hitter.

The last-place Padres signed Ramirez, who made the AL All-Star team in 2014, as a free agent this past offseason. He played his first eight years with the White Sox, batting .273 with 109 homers.

“He didn’t have the range at shortstop anymore that we need,” manager Andy Green said. “We told him he wasn’t going to be our everyday shortstop anymore.”

Ramirez had begun learning to play the corner outfield positions to stay in the lineup. Green said Alexi Amarista, who got the start at shortstop for the series finale against the Dodgers, would be given a chance to show what he can do the rest of the season.

“We need an anchor at shortstop. San Diego hasn’t had an anchor at shortstop for a long time,” Green said. “We’re not making a pennant push so we’re thinking about next season and we want to see what some of the young guys can do.”