A man nominated by Donald Trump for the role of federal judge has withdrawn his candidacy following a humiliating interview last week, which went viral.

Matthew Petersen, a 47-year-old member of the federal election commission, was nominated to be a judge in the District of Columbia.

But Mr Petersen suffered an excruciating confirmation hearing on Wednesday, when he failed to answer the most basic legal questions.

He was grilled by John Kennedy, a Republican from Louisiana, in a hearing session that was widely shared on social media.

Mr Kennedy asked whether any of the nominees have not tried a case to verdict in a courtroom. Only Mr Petersen raises his hand.

Mr Kennedy then asked whether he had tried a jury trial, a civil trial, a criminal trial, a bench trial, and a state or federal court trial. Mr Peterson answers no to every question.

"Have you ever taken a deposition by yourself?" Mr Kennedy asked.

"Uh, I believe no," Mr Peterson replied.

"Just for the record, do you know what a motion in limine is?" Mr Kennedy asked.

"I would probably not be able to give you a good definition right here at the table," said Mr Petersen.