NEW YORK - Liberty Media has agreed to $530 million in loans to Sirius XM Radio Inc, saving the satellite radio provider from possible bankruptcy and giving Liberty a 40 percent equity stake.

Under the agreement, Liberty, controlled by media mogul John Malone, would offer loans to Sirius, a portion of which will help pay $171.6 million in debt that was due on Tuesday.

Had Sirius been unable to make that payment it said it would have had to seek bankruptcy protection.

Once the loans are completed, Sirius XM will issue Liberty 12.5 million shares of preferred stock convertible into 40 percent of the common stock of Sirius XM.

Liberty expects that Malone and Greg Maffei will join the Sirius XM Board of Directors.

(Reporting by Franklin Paul, editing by Dave Zimmerman)