FILE PHOTO: Berkshire Hathaway CEO Warren Buffett visits the BNSF booth before the Berkshire Hathaway annual meeting in Omaha, Nebraska, U.S. May 6, 2017. REUTERS/Rick Wilking/File Photo

(Reuters) - Warren Buffett's failure to clinch a $9 billion takeover of the Texas utility Oncor prompted S&P Global Ratings on Tuesday to say the billionaire's Berkshire Hathaway Inc BRKa.N is no longer at risk of a credit rating downgrade.

S&P affirmed Berkshire's "AA" rating, its third-highest grade, with a "stable" outlook after Sempra Energy SRE.N struck an agreement with Oncor's bankrupt parent Energy Future Holdings Corp on a $9.45 billion purchase.

The rating agency had put Berkshire on review for a possible downgrade on July 7, reflecting concern about how adding Oncor would affect leverage.

It said the stable outlook reflects Berkshire’s solid profitability and significant cash flow, the strong competitive position of many business units, and Buffett’s focus on boosting operating profit, which totaled $17.58 billion last year.

Few U.S. companies have credit ratings as high as Berkshire’s, which itself carried a “triple-A” rating from S&P as recently as February 2010. Moody’s Investors Service rates Berkshire “Aa2,” equivalent to S&P’s rating.

Barclays Capital analyst Jay Gelb said in a research report that the loss of Oncor leaves Berkshire with about $80 billion of cash for acquisitions, while leaving Buffett the cushion he wants for such things as payouts by Berkshire insurance units.

At Berkshire’s annual meeting in May, Vice Chairman Charlie Munger suggested that the Omaha, Nebraska-based conglomerate might be capable of a $150 billion acquisition.

Buffett responded that he was more “conservative,” though he has long expressed a preference for buying whole businesses over making smaller investments. He turns 87 on August 30.