A trial at which Tom Hanks was a juror has collapsed after a "star-struck" prosecutor spoke to the Oscar-winning actor, breaching jury tampering rules.

Hanks was on the panel hearing a domestic violence case in Los Angeles when the female prosecutor approached him outside the courtroom to praise the fact that he was doing his jury duty.

The prosecutor was not assigned to the case, but court rules impose a strict ban on lawyers talking to jurors at any time, to guard against the possibility of interfering with the jury.

"She made contact with Mr Hanks in the stairwell of the building. She came up to him and thanked him, and (said) how impressed everyone is that such a celebrity would still be here serving jury duty," Andrew Flier, the defence lawyer in the case, told entertainment website TMZ.

"So she, in essence, was being maybe a little star-struck and nice, but it's an absolute 100 per cent no-no and should never have happened."

The defendant in the case could have faced up to a year in jail, but after hearing about the breach of rules, prosecutors struck a plea deal with the defence, under which a $150 fine was agreed for a lesser charge.

A spokesman for the Los Angeles City Attorney's Office, Frank Mateljan, said the City Attorney was reviewing the case.

"The case settled yesterday. As a matter of professional course, our attorney did inform the court that during one of the lunch breaks another attorney... had a brief encounter with Mr Hanks," he said.

"The defendant ended up entering a 'no contest' plea to a lesser charge, a disturbing-the-peace charge," he added.

It is not known if the prosecutor involved will face disciplinary action.

"The city attorney is in the process of being apprised of what took place, and he will review and take the appropriate action," Mr Mateljan said.

A spokeswoman for Hanks did not immediately respond to a request for comment.

AFP