CLEVELAND (AP) — The Indians had little choice but to give up Justin Masterson. The trade doesn’t mean they’re going to surrender the season.

“We will never raise the white flag,” Cleveland manager Terry Francona said. “That’s not an option. Anybody who stands next to me in the dugout knows that will never happen.”

Protecting themselves in case the 29-year-old Masterson left as a free agent after the season, the Indians traded the right-hander on Wednesday to the St. Louis Cardinals.

The trade of Masterson could be followed by other moves by the Indians, who entered Wednesday 6 1-2 games behind first-place Detroit in the AL Central and in a scramble with five other teams for the league’s second wild-card spot.

The Indians could also trade shortstop Asdrubal Cabrera before the deadline. Like Masterson, Cabrera is in the final year of his contract and the Indians have shown little interest in re-signing him. Dealing the two-time All-Star could bring a prospect in return.

General manager Chris Antonetti said he’s exploring deals to improve the team before Thursday’s 4 p.m. trade deadline.

“Our focus is to continue to try to win as many games as we can,” he said. “We’re currently in the midst of having conversations to bring players in to impact our team at the major league level. Whether or not that happens over the next 24 hours, there are a lot of factors in play and it’s hard to handicap that.”

Masterson began the season as the Indians’ ace. He’ll end it with a different team in a different league after a disappointing four months.

“I was surprised,” Masterson said. “It’s bittersweet. I’m sad to leave the fellas and the fight we’re making here in Cleveland, but I’m excited to get to St. Louis and be a part of what they have going there.”

In exchange for Masterson, who was scheduled to come off the disabled list later this week, the Indians got outfielder James Ramsey. A first-round pick by the Cardinals (No. 23 overall) in 2012, Ramsey has spent this season at Double-A Springfield, where he batted .300 with 13 home runs and 36 RBIs.

Antonetti said Ramsey will be moved up to Triple-A Columbus.

Masterson went 14-10 last season and then turned down an offer of a contract extension in spring training.

“It’s an extraordinarily difficult day for us,” Antonetti said. “It wasn’t an easy decision, but it’s one that made sense.”

Masterson is 4-6 with a 5.51 ERA in 19 starts this season and has had a noticeable loss in velocity. In five starts before being placed on the DL with right knee inflammation, he allowed 19 runs and 27 hits in 18 innings.

Masterson, who hasn’t won since June 8, said the impending free agency didn’t affect his performance.

“I guess I could try and blame that, but that would be a lie,” he said.

The Cardinals are in the race for the NL Central crown, a season after going to the World Series.

Masterson was acquired by the Indians at the trading deadline in 2009 in the deal that sent catcher Victor Martinez to Boston. Before Tuesday’s series opener against Seattle, Masterson said he wouldn’t be surprised if the Indians made any moves before the trade deadline Thursday.

Masterson had said he was hoping to stay and help them make a playoff push.

Francona was Boston’s manager when Masterson was dealt to Cleveland.

“The hug was a little longer than normal,” Francona said. “We may part teams, but my admiration for him isn’t parting.”

Joked Masterson: “Tito keeps trading me away. What’s up with that?”

Masterson went 48-61 with Cleveland. He expects to join the Cardinals in the next day or two and said he might start a game this weekend.