NANTUCKET, Massachusetts — The young man accusing Kevin Spacey of groping him in a Massachusetts bar invoked his Fifth Amendment rights Monday after being questioned about his role in the deleting of text messages from a phone key to the case.

The pretrial drama, which threatened to unravel the entire case against Spacey, erupted out of what had started as a seemingly routine matter: the whereabouts of a phone the accuser had when Spacey allegedly groped him at the Club Car restaurant and bar in Nantucket in the early morning hours of July 8, 2016.

"Your honor, we could not locate the phone," family attorney Mitchell Garabedian told Nantucket District Court Judge Thomas Barrett at the start of the hearing.

Then, on the witness stand, the accuser said he had not altered or deleted any potential evidence off that iPhone he had in 2016.

But when defense lawyer Alan Jackson reminded him it is a felony to alter evidence, the court took a break and then the young man told Barrett — through a public defender assigned on the spot — he'd invoke his right against self-incrimination on the phone issue.

If the accuser refuses to answer any questions, then the whole case should be tossed, according to Jackson.

"This entire case is completely compromised. He is the sole witness," Jackson pleaded. "This case needs to be dismissed, and I believe it needs to be dismissed today."

And Judge Barrett seemed to agree, but put the matter off so prosecutors could discuss their next move.

Barrett ordered both sides back to court on July 31.

"You may be on the money," Barrett told the defense. "It might be dismissed for the reasons indicated but it's not going to happen today."

The accuser had taken the stand and said that some of the text messages, with his then-girlfriend and a group chat with seven male pals, from the time in question have gone missing.

"I did not delete any information," the accuser, who was 18 at the time of the incident, said. "I gave what I had available to me at the time and I did not manipulate any of that."

But then after a break in testimony, he told the judge he is pleading the Fifth Amendment. Barrett then had all of the accuser's previous testimony, given just minutes earlier, stricken from the record and said it was not to be used in any further court proceedings.

Both of the accuser's parents took the witness stand, where they testified to having no idea where the phone had gone.

The father continually clashed with Jackson and accused the defense lawyer of asking inappropriate questions.

“I think you’ve had way too many questions that have gone way too far," the dad lashed out, earning a rebuke from Judge Barrett.

“Listen to me, you keep this up, I’m going to hold you in contempt," Barrett scolded. "This is a criminal proceeding and you will cooperate!"

The mom, former Boston TV news anchor Heather Unruh, admitted on the stand that she deleted, off her son's phone, a handful of photos and song lyrics she found to be racist. But Unruh insisted nothing she deleted were connected to the case.

"It was not relevant to the case," she said. "I did not touch anything relevant to the case."

That answer sparked an angry response from Jackson.

"Ms. Unruh, you are not the gatekeeper were you?" Jackson said. "The police were the gatekeeper. And God forbid we might the gatekeeper, or the judge might be the gatekeeper. You understand that right?

She responded: "I'm beginning to understand that now."

Two state troopers took the witness stand and told the court they were given the accuser's phone in November 2017 and gave it back to the family a month later.

But the accuser and his parents insist they don't recall receiving the phone back from police, or know where it is now.

"They're pointing at each other," Jackson told the judge, pointing index fingers from both of his hands in opposite directions. "And guess who loses because of this? That would be us, because we're entitled to the phone. "

The prosecution declined comment after Monday's explosive hearing.

Spacey, 59, has pleaded not guilty to indecent assault and battery, a charge that carries a maximum penalty of 2 1/2 years behind bars. The actor was not in court Monday.

Last week, the accuser dropped his civil lawsuit against the actor.

Ezra Kaplan reported from Nantucket and David K. Li from New York