Image copyright Getty Images Image caption Gang Starr in 1991 (L-R): DJ Premier and MC Guru

"Who'd have thought you'd be rhyming with ghosts?" J Cole asks himself, as he trades bars with the late rap legend Guru on Gang Starr's new single Family and Loyalty.

The answer is complicated. Really complicated.

Gang Starr were the Brooklyn rap group who set the bar for street-wise, sample-chopping, socially-conscious rap in the 1990s, with singles like Just To Get A Rep, Mass Appeal and Step In The Arena.

But when their charismatic frontman Guru died in 2010 from a rare form of cancer, the chances of hearing the band's unreleased music appeared to have died along with him, with the star writing a letter from his deathbed that effectively cut his musical partner DJ Premier out of his legacy.

"I do not wish my ex-DJ to have anything to do with my name likeness, events [or] tributes," he wrote. "I had nothing to do with him in life for over seven years and want nothing to do with him in death."

Instead, he entrusted his life's work to another musician, John Mosher, known as DJ Solar, who he'd met while working on Gang Starr's final album, The Ownerz in 2001.

The letter was published shortly after his death and, in lieu of a will, appeared to represent the rapper's dying wishes. But almost immediately, it became mired in controversy.

"Solar claimed that everything was willed to him and it's like, 'Why wouldn't it be willed to his son?'" says DJ Premier. "Guru loved his son, and he was only nine years old.

"It was just the weirdest situation we've ever seen."

Guru's family agreed. They maintained the star had been in a coma for the last two months of his life, so could not have written, or even dictated, the deathbed letter.

They took Solar to court, where Guru's oncologist testified the rapper would have been incapable of putting together such a document. In 2014, a New York judge ruled in the family's favour, saying Solar had no claim over "any writings, drawings, designs, lyrics, or notes created by [Guru] and/or any recordings embodying [his] voice".

Premier, whose real name is Christopher Edward Martin, was convinced there'd be music in the vault. Guru, he says, recorded almost daily. But getting his hands on those recordings would take years.

Ransom

"When Solar lost the case, he went into appeal and that freezes everything from being handed over," he tells the BBC.

It wasn't until 2017 that he was finally able to negotiate, through a lawyer, to purchase 30 of Guru's unreleased recordings for an undisclosed sum.

"I looked at it as a ransom, and it was worth the ransom," he says. "It was like, 'That's our child and we want our child back.'"

It's no secret that Guru and Premier had become estranged over the years. Money, ego and Guru's alcohol problem all played a role. But when Premier heard his friend's whip-smart vocals coming through the speakers again, he broke out in "goosebumps".

"I just knew this was a big thing," he says. "He was doing what he was greatest at."

The recordings laid the groundwork for One Of The Best Yet, Gang Starr's first album in 16 years. Every day for 18 months, Premier would craft beats and structure samples around the vocals, with Guru's ashes sitting on the recording console as a talisman.

Image copyright Daniel Hastings Image caption The band were one of the most influential proponents of the "boom-bap" sound

It was a complete reversal of their old recording method, where the producer would lay down an instrumental, and Guru would take inspiration from music as he wrote or freestyled his lyrics.

"This very different, a bit like doing a remix," says Premier, who has worked with everyone from Jay-Z and Nas to Christina Aguilera and Janet Jackson. "I'd listen to what he was saying, and I could immediately hear where I wanted to go with it."

The sessions took place in the DJ's own studio in Queens, New York, which became important as emotions took their toll.

"There were times when I'd be like, 'Damn! Let me cry again'. I'd go off and lock the door saying, 'Hey guys, I'll be right back.'

"It was more out of anger that he's not here than feeling sad. But at the same time, you're crying because you're happy, like, 'Aw man, wait until the world gets this.'"

The finished record doesn't disappoint - resurrecting Gang Starr's dusty grooves and block-rocking beats; while Guru's streetwise rhymes still sound dextrous and fresh.

Premier called in some favours, too, securing cameos from MOP, Q-Tip and Royce da 5'9" - authentic voices from hip-hop's old school - but the most emotional moment comes when Guru's son arrives towards the end of side one.

"My name is Keith Casim Elam and Guru is my father: The late king who provided lyrical slaughter," he says in a short, spoken-word interlude, pausing briefly before he continues: "And he's still here."

"Did you notice the gap?" asks Premier. "On the original recording, there was this long silence after he said 'lyrical slaughter'. I peered out from behind the speakers to look at him, and I hit the talk button and said, 'Are you alright?'

"And then he goes, 'He's still here, shining down upon us, one of the best yet.'

"I was like, 'Wow'. You could feel the emotion of him getting caught up as he took that breath."

Image copyright DJ Premier / Instagram Image caption DJ Premier in the studio with Guru's son, Keith

Premier says that, above anything else, One Of The Best Yet is a gift to Keith and Guru's sister, Trish.

"The family can eat off of it," he says. "That's the most important thing."

The album came out a couple of weeks ago to almost universal praise. Rolling Stone magazine said "it feels like one of the most beloved rap groups in history are picking up right where they left off"; while NPR observed, "it's a welcome reminder of what made the group eternally great."

But the story doesn't quite end there.

After the album came out, DJ Solar told the New York Times the songs had essentially been stolen from him.

According to the musician, there was "no valid agreement" with Premier, and he planned to take legal action to get his name added to the credits.

Premier's manager responded by providing the Times with notarised document, signed by Solar in 2017, stating he was not a songwriter, producer or performer on the master recordings.

Image copyright DJ Premier Image caption DJ Premier says his next project is a Gang Starr documentary, which he hopes to sell to Netflix

Things got weirder still. Friends started calling Premier, saying they recognised Guru's vocals from recordings they'd made with the rapper, that had nothing to do with Gang Starr or Solar.

"People are coming out of the woodwork going, 'Hey man, that's a record we did in 1999,'" says the musician. "And I'm checking the date of the session, and it is 1999. He [Solar] wasn't even around us at that time."

So far, three tracks have been flagged up, with the likes of Masta Ace and Agallah The Don claiming ownership of the recordings.

"Agallah, who's also an accomplished MC, sent me the original record and the details of the studio and the pressing plant," he says. "There was only, like, 100 copies pressed but I was like, 'Damn, that's another one.'"

"These are sessions that Solar should not have been in possession of.'"

'Why would you trust Solar?'

That sentiment is echoed by Fong Sai U, whose 2001 collaboration with Guru, What's Real, somehow made its way onto Gang Starr's posthumous project.

"Man, I cried when I heard that verse on the album," he says. "I couldn't believe it.

"I never really wanted that song out. That's why I never used it for a single and that's why I put it at the end of my album, Ballads of a Massacre [2015].

"But that verse was was sentimental to me after Guru passed 'cause that's all I had left to remember him by."

The rapper can't understand how DJ Premier failed to spot that Guru's vocals had previously been released.

"Premier should have done his research," he says. "Why would you trust Solar?"

Fong Sai U says he's currently "at the table" with Gang Starr's lawyers in an effort to sort out the copyright.

"Hopefully the right thing will be done and both parties can move on and celebrate Guru's legacy," he says.

Premier, for his part, says the other conflicts have been resolved.

"People know I didn't do anything sneaky, so they're like, 'Dude, do your thing, we're just happy you got 'em,'" says the producer.

"Honestly, it's a positive thing. Guru's family said that was him manipulating things from above, saying, 'Hey, this is what was really going on all this time. I know y'all can handle it.'"

The BBC has contacted DJ Solar to comment on this story, but has yet to receive a response. The story was updated on 27 November, 2019, to incorporate Fong Sai U's comments.

Follow us on Facebook, or on Twitter @BBCNewsEnts. If you have a story suggestion email entertainment.news@bbc.co.uk.