The Miami Heat have known for weeks that they had the option of sending Shawn Marion to the Toronto Raptors in a deal for center Jermaine O'Neal.

Miami finally took that option Friday, taking the Heat out of the chase for Marion's ex-Phoenix Suns teammate Amare Stoudemire.

In a deal first reported by ESPN The Magazine's Ric Bucher, the Heat agreed to trade Marion and guard Marcus Banks to the Raptors for O'Neal and swingman Jamario Moon.

NBA officials approved the swap Friday afternoon by conference call, the Heat said.

The deal also calls for Toronto to get the league's maximum allowed in cash considerations ($3 million) and for the Heat to land a conditional first-round pick to come sometime between 2010 and 2015. It's lottery-protected, essentially meaning the first time the Raptors make the playoffs after this season, their first-rounder goes to Miami.

If Miami does not get that first-round pick in 2010, it will get an additional second-round pick that year. The Heat also get a $4.2 million trade exception, which would allow Miami to make a future trade even if the salaries involved don't match.

"This is a win-win for both Toronto and Miami and we wish J.O. and Jamario the best," said Raptors general manager Bryan Colangelo, who is familiar with Marion from his time with the Phoenix Suns.

The deal was struck mere hours after Marion's dunk with 1.1 seconds to go delivered a 95-93 victory in Chicago in the Heat's final game before the All-Star break.

The Heat and Raptors began discussing a swap featuring Marion and O'Neal in January, but Miami held off in hopes of finding an impact player in better health than O'Neal, who has missed 14 games in his first season in Toronto because of persistent knee trouble.

"I developed an unbelievable relationship with Shawn," Heat star guard Dwyane Wade said in Phoenix, where he's part of All-Star Weekend. "You're sad to lose a friend on and off the court. At the same time, Shawn and I just had this conversation that it's part of the business and we knew it was a possibility."

The Heat, according to NBA front-office sources, made numerous attempts to acquire Dallas swingman Josh Howard with Marion's expiring $17.8 million salary, and more recently tried to use Marion's cap-friendly contract to get into the bidding for Stoudemire.

Sources say that the Suns, though, had made it clear to the Heat in recent days they were not interested in reacquiring Marion -- in spite of the financial benefits -- for the rest of the season.