DUBLIN — Rory McIlroy reached a settlement with his former management company on Wednesday, cutting a multimillion-dollar deal to end their contract dispute and avoid a lengthy court case exposing the financial dealings of the world’s top-ranked golfer.

Conor Ridge, the leading agent of Horizon Sports Management, hugged and kissed his supporters in the public gallery after the announcement was made in a Dublin court.

“The legal dispute between Rory McIlroy and Horizon Sports Management has been settled to the satisfaction of both parties who wish each other well for the future,” both sides said in a joint statement released at the start of the second day of the case.

McIlroy was not in court for Wednesday’s brief hearing.

McIlroy’s former agent, Conor Ridge, outside courtAP

The four-time major winner terminated his contract with Horizon in 2013 to form his own company. He was suing Horizon and Ridge, claiming his interests were not properly looked after and that he was misled into signing the contract.

McIlroy had said in court papers that he signed the deal “in circumstances of great informality,” and without having seen a draft of the agreement before it was given to him to sign.

Horizon was counter-suing, claiming McIlroy breached his contract and that he owed the company millions of dollars in commissions. Among the lucrative deals signed by McIlroy while at Horizon was one with Nike at the start of 2013 that was worth $100 million over five years.

Attempts at resolving the bitter dispute failed in December. The court case would have lasted up to eight weeks and McIlroy had been expected to testify this week.

The case was adjourned three times Tuesday to allow the sides to negotiate. After about 10 hours of talks, McIlroy left at 9 p.m. without making any comment.

McIlroy had left Horizon because he was unhappy about the rates he was being charged — 5 percent of pre-tax prize winnings and 20 percent of sponsorship and appearances money. McIlroy claimed the terms were inferior to those given to other top-10 players, including fellow countryman and friend Graeme McDowell, who was also a Horizon client.

McIlroy’s business interests are now overseen by Rory McIlroy Inc., which is headed by a former employee of Horizon, father Gerry and a family friend.

McIlroy is coming off a victory at the Dubai Desert Classic last Sunday, his first tournament win of the year. He is scheduled to return to action at the Honda Classic starting Feb. 26 and will look to complete the Grand Slam of majors by winning the Masters in April.