Potentially tying a bow on one of the more odd transaction storylines in baseball, the Philadelphia Phillies traded reliever Juan Nicasio to the Cardinals for their No. 19 prospect, second baseman Eliezer Alvarez.

Nicasio has been one of baseball’s most effective relievers this season, owning a 2.79 ERA and 61 strikeouts across 61 1/3 frames this year, which is why it was so surprising to see the Pirates place Nicasio on outright waivers last week, essentially giving away the right-handed pitcher to Philadelphia for free. With just $600,000 remaining on his salary, it looked like Pittsburgh was being cheap, but there’s more to the story than that.

The Pirates placed Nicasio on revocable waivers, only for a team within the division to claim him and, with no real leverage, Pittsburgh decided it was better to give away Nicasio rather than accept a poor offer and help a rival team compete for the World Series. With the Pirates out of the playoff hunt and Nicasio on an expiring deal, Pittsburgh felt it was more worthwhile to see what their prospects can show at the major league level rather than keep Nicasio.

Regardless, Nicasio found his way to a rival club in the NL Central, but since he was traded after Aug. 31, he won’t be eligible to be on the Cardinals playoff roster. With a month of meaningful baseball left in St. Louis, however, he is still able to provide quality relief innings for the month.

Philadelphia, who is among the worst teams in baseball, swooped in and landed Nicasio, sent him to the mound for two games (and he won one of them!) and were able to flip him for a prospect. And while Alvarez is far from one of the Cardinals high-end prospects, he is a lottery ticket for Philadelphia who was acquired at a low cost.

In the end, all three teams in their own way won. The Pirates avoided allowing Nicasio to pitch for a rival club during the playoffs, Philadelphia acquired a decent prospect for a player they controlled for one week and St. Louis added another guy who can help them right for a Wild Card spot.