Sheikh Abdulla bin Hamad Al Khalifa, second son of the King of Bahrain, had set Jackson up with a recording studio at his Neverland ranch and then sent him his compositions.
Bankim Thanki QC, representing the sheikh, told Mr Justice Sweeney that the day after Jackson's criminal trial ended over child molestation charges in California, the star recorded one of the compositions which the sheikh wanted released as a charity single to help victims of the Boxing Day tsunami.
Mr Thanki promised the judge that a recording of the song would be played in court during the trial.
"It shows the quality of Sheikh Abdulla's song writing skills and that of Mr Jackson's voice," he told the judge.
The two had a "close personal relationship" and discussed the chances of Jackson moving to Bahrain after the end of his criminal trial to "continue their musical collaboration in a more conducive environment", said Mr Thanki.
The sheikh had plans to revive Jackson's musical career, releasing records through their own musical label.
"Sheikh Abdulla began to support Mr Jackson financially after 2005 when it became clear that Mr Jackson was in very serious financial difficulties, much to Sheikh Abdulla's surprise," said Mr Thanki.
He said the sheikh was first asked by an assistant of Jackson for 35,000 US dollars to pay utility bills at Neverland.
The following month, in April 2005, Jackson asked for one million dollars through an assistant.
"Sheikh Abdulla made many more payments on his behalf or to others," said Mr Thanki, including Jackson's 2.2 million dollar legal bill for his criminal trial.
The sheikh is suing the pop music legend for allegedly reneging on a 7,000,000 US dollar (4.7 million) "pay-back" agreement designed to repay money he advanced to Jackson during his worst financial troubles.
He claims he and Jackson entered into a "combined rights agreement" (CRA) under which the troubled superstar was committed to a recording contract, the production of an autobiography and a musical stage play.
But Jackson is contesting the claim, insisting there was no valid agreement and that the sheikh's case is based on "mistake, misrepresentation and undue influence".
In his pleaded defence, Jackson says the payments he received were "gifts" and that no project was ever finalised.
At the start of a court hearing in London set for up to 12 days, Mr Justice Sweeney heard that an application would be made for Jackson to give evidence via video link from Los Angeles.
Sheikh Abdullah is the Governor of the Southern Governate of Bahrain and head of the country's Public Commission for the Protection of Marine Resources, Environment and Wildlife.
He is also the founder of the 2 Seas Group, an entertainment and record production label, and says he became Jackson's close friend during the star's six-month stay in Bahrain in 2005.