Kakao had bid to take a 9.05% stake in the K-pop agency, while HYBE, the agency of K-Pop supergroup BTS, has been building up a stake in SM with the aim of taking control.

Lee said in a statement he had spent the last two years looking for the best producer to take over SM after his exit.

"For me, 'The Best' was HYBE. Although they were in competition with SM, the success of BTS is the pride of all of our people," Lee said.

Lee filed for an injunction in early February to block Kakao's acquisition of the SM stake through a deal worth 217.2 billion won ($172.8 million), which he criticised as unlawful and violating shareholder rights.

HYBE purchased a 14.8% stake in SM from founder Lee last month and sought to acquire up to 25% more shares through a tender offer to take management control of the agency, a move analysts say would help the BTS agency diversify revenue streams.

HYBE said results of the tender offer will not be disclosed until March 6.

Shares of SM closed up 1% at 129,200 won on Friday prior to the court ruling. The stock had been trading above HYBE's tender offer price of 120,000 won since the middle of last month amid a takeover battle between HYBE and an SM-Kakao alliance.

SM's current management have called the takeover attempt hostile and has sought to team up with Kakao to pursue various businesses.

SM and Kakao did not immediately reply to requests from Reuters for comment.

(Reporting by Hyunsu Yim; editing by John Stonestreet, Robert Birsel and Susan Fenton)

By Hyunsu Yim