Tupac Shakur wrote to Madonna from prison to apologise and explain that he split up with her because of race issues, according to a newly surfaced letter.

The rapper 2Pac said he wanted to meet up to discuss friendship, according to the highly personal missive, but he was shot dead less than a year after his release.

Tupac Shakur Madonna letter
The auctioneers say the letter was penned by Tupac Shakur from prison (Frank Wiese/AP)

Madonna confirmed two years ago that they had been dating in early 1994 but did not say for how long.

The letter, dated January 15, 1995, would have been written from a New York prison where he was serving a four-and-a-half year sentence for sexual assault.

“For you to be seen with a black man wouldn’t in any way jeopardize your career, if anything it would make you seem that much more open and exciting,” it says.

“But for me at least in my previous perception I felt due to my ‘image’ I would be letting down half of the people who made me what I thought I was.

“I never meant to hurt you.”

Tupac Madonna letter
The first page of the letter penned in prison (Gotta Have Rock and Roll/PA)

The letter, to be auctioned on the Gotta Have Rock And Roll website later this month, says he had grown “spiritually and mentally” and no longer cared about perceptions.

“Please understand my previous position as that of a young man with limited experience with an extremely famous sex symbol,” it adds.

He offered his friendship and said he wanted to meet up to discuss this, according to the letter sent before he was bailed in October 1995.

Tupac Madonna letter
The letter’s second page (Gotta Have Rock and Roll/PA)

But in September the following year Shakur was fatally hit in a drive-by shooting in Las Vegas. He died six days later at the age of 25.

Madonna caused controversy for repeatedly swearing on the Late Show with David Letterman in March 1994 and she later gave their relationship as an explanation.

“I was dating Tupac Shakur at the time and the thing is he like got me all riled up about life in general so when I went on the show I was feeling very gangster,” she told a radio show.

Madonna Tupac Shakur letter
Madonna previously revealed they had dated (Aurore Marechal/PA)

Representatives for Shakur and Madonna, 58, are yet to comment on the letter first published by TMZ, but Rolling Stone claims to have authenticated it.

A spokeswoman for Gotta Have Rock And Roll, which will auction the letter between July 19-28, said: “It’s from a close contact of Madonna’s who worked with her for over 20 years.”