• Video report by ITV News Royal Editor Chris Ship

Text messages sent between the Duke and Duchess of Sussex and her father Thomas Markle in the months leading up to their wedding show the pair tried to warn him that contacting the press would "backfire".

The messages were referred to in court documents issued ahead of the first hearing, due to take place on Friday, in Meghan's privacy claim against Associated Newspapers, publisher of The Mail on Sunday and MailOnline, over publication of a letter she sent to her father.

In texts sent on May 14, 2018 after calls to Mr Markle, 75, went unanswered, Harry wrote: "Tom, Harry again! Really need to speak to u.

"U do not need to apologize, we understand the circumstances but 'going public' will only make the situation worse.

"If u love Meg and want to make it right please call me as there are two other options which don't involve u having to speak to the media, who incidentally created this whole situation.

"So please call me so I can explain. Meg and I are not angry, we just need to speak to u. Thanks.

"Oh any speaking to the press WILL backfire, trust me Tom. Only we can help u, as we have been trying from day 1."

The details have been revealed in a series of court documents. Credit: PA / GMB

The documents state that, rather than responding to the calls and messages, Mr Markle issued a public statement through US website TMZ that he had gone to hospital because he had suffered a heart attack.

They also reveal this is how Meghan first learned her father was in hospital.

In a text to her father on May 15, 2018, four days before her wedding, Meghan wrote: "I've been reaching out to you all weekend but you're not taking any of our calls or replying to any texts.

"Very concerned about your health and safety and have taken every measure to protect you but not sure what more we can do if you don't respond.

"Do you need help? Can we send the security team down again? I'm very sorry to hear you're in the hospital but need you to please get in touch with us... What hospital are you at?"

The duchess sent another text about 10 minutes later, saying: "Harry and I made a decision earlier today and are dispatching the same security guys you turned away this weekend to be a presence on the ground to make sure you're safe... they will be there at your disposal as soon as you need them.

"Please, please call as soon as you can.. all of this is incredibly concerning but your health is most important."

Mr Markle responded by saying he would be in hospital for a few days but was OK, and refused the offer of security.

Documents also showed Meghan's father called her in the early hours of her wedding day, but the call was missed.

The documents, which were issued in reply to Associated Newspapers' defence of the case, reveal Harry then sent a further message from his wife's phone to provide Mr Markle with details of the security team.

Harry also asked his father-in-law to speak to him about letting a security guard the couple had sent to help Mr Markle return to his house, according to the court papers.

David Sherborne, the lawyer representing Meghan in her claim against the publisher, said in the documents: "The claimant's husband pleaded with Mr Markle to let them help him.

"While Mr Markle responded later that evening to say that he appreciated the offer but did not feel in danger and would instead recover at a motel, the claimant responded 10 minutes later to make a further request for the hospital details so that she would know where he was.

"The claimant will refer to the fact that the defendant's description of this exchange intentionally omits any reference to the claimant or her husband attempting to protect Mr Markle and ensure that he was safe."

Details of the conversations have been revealed in court documents. Credit: PA

The defence document filed by Associated Newspapers sets out that Mr Markle underwent emergency heart surgery on May 16, 2018, and that he texted his daughter on the same day to let her know he would not be able to attend the wedding as his doctors would not allow him to fly.

The document states: "He told the claimant he loved her and wished her the best.

"He sent a follow-up message asking who would 'be giving [her] away?' and saying that if she really needed him he would come, and that he was sorry 'about all this'.

"In response, he received a text response signed 'Love M and H', but which read as if it was from Prince Harry, (amongst other things) admonishing Mr Markle for talking to the press and telling him to stop, and accusing Mr Markle of causing hurt to his daughter.

"The text did not ask how the surgical procedure had gone or how Mr Markle was or send him good wishes.

"Mr Markle was deeply hurt and responded with a curt message: 'I've done nothing to hurt you Meghan or anyone else I know nothing about 20 phone calls I'm sorry my heart attack is there any inconvenience for you', and a couple more short messages."

In reply to that part of the defence, Meghan's lawyers said it was "misleading" and that the duchess does not accept that text message came from her father "as opposed to someone pretending to be him".

Mr Sherborne continues: "As a result of this, and the unpleasant nature of the message she received on May 16, the claimant called Mr Markle a further four times within five minutes of the message being sent, but he declined to pick up.

"Her husband even texted Mr Markle from the claimant's phone to say: 'Tom, it's Harry, please answer your phone. I need to know this is actually you because it doesn't sound like you at all.' No response was received."

Mr Sherborne said it is "admitted and averred" that, following the "unpleasant message", which Meghan was unsure came from her father, and his failure to respond to calls and messages from the couple, the duchess did not speak to her father before her wedding on May 19.

He said Meghan denies any further contact from her father and did not receive a text message from him in November 2018, which - according to Associated Newspapers' defence - read: "I want to reach out to you or try to reach out to you one more time.

"You apparently have just written me off and now it's telling me I guess for the rest of my life?"

The hearing, raised by Meghan Markle, will continue on Friday.