A Cape Cod man who claimed he was homophobic, racist and a habitual liar to avoid jury duty earned an angry rebuke from a judge, who referred the case to prosecutors for possible charges.

"In 32 years of service in courtrooms, as a prosecutor, as a defense attorney and now as a judge, I have quite frankly never confronted such a brazen situation of an individual attempting to avoid juror service," Judge Gary Nickerson told Daniel Ellis on Monday, according to a preliminary court transcript of the exchange.

Ellis had been called to court with about 60 other potential jurors for possible service on a 23-member grand jury. During the selection process, lawyers on both sides try to weed out possible jurors who might have biases that would stop them from being impartial.

Click here for FOXNews.com's Crime center.

On a questionnaire that all potential jurors fill out, Ellis wrote that he did not like homosexuals and blacks. He then echoed those sentiments in an interview with Nickerson.

"You say on your form that you're not a fan of homosexuals," Nickerson said.

"That I'm a racist," Ellis interrupted.

"I'm frequently found to be a liar, too. I can't really help it," Ellis added.

"I'm sorry?" Nickerson said.

"I said I'm frequently found to be a liar," Ellis replied.

"So, are you lying to me now?" Nickerson asked.

"Well, I don't know. I might be," was the response.

Ellis then admitted he really didn't want to serve on a jury.

"I have the distinct impression that you're intentionally trying to avoid jury service," Nickerson said.

"That's true," Ellis answered.

Nickerson ordered Ellis taken into custody. He was released later Monday morning.

Ellis could face perjury and other charges.

Click here for FOXNews.com's Crime center.