A black barrister mistaken for a defendant three times in one day has received an apology from court officials.
Criminal and family lawyer Alexandra Wilson, 25, said the experience had left her "absolutely exhausted".
She lodged a formal complaint after being challenged by a security officer, a solicitor and a clerk.
Her Majesty's Courts and Tribunals Service (HMCTS) apologised for the "totally unacceptable behaviour".
Ms Wilson, from Essex, said she had attended the magistrates' court - where barristers' traditional wigs and gowns are not usually worn - on Wednesday.
Upon arrival, she said a security officer asked for her name and then searched for it on a list of defendants.
"I explained I was a barrister. He apologised and guided me through security," Ms Wilson said.
After meeting her client, she tried to enter a courtroom to discuss the case with the prosecutor.
"Another barrister or solicitor sitting at the back of the court told me to go outside and wait and to sign in with the usher for my case.
"I explained again I was a barrister and she looked awfully embarrassed and said 'I see'.
"At this point as I was already pretty annoyed, but I went over to the prosecutor and then the clerk told me very loudly to get out of the court room because I had to wait for my case to come on.
"I was nearly in tears, and I said again, 'I am a defence barrister', and she nodded her head and turned back to her computer."
In addition, she said, a member of the public thought she was a journalist and told her "only lawyers can go in" the courtroom.
"All of that in one day, it made me feel exhausted," she said.
"This really isn't ok... I don't expect to have to constantly justify my existence at work."
She told the BBC she was "quite often" mistaken for a defendant but never so often in one day, and her experience had made her realise "it's not nice being a defendant in court".
"Everyone should be treated with respect," she said.
"The fact I was shouted at to get out of court isn't ok for defendants either."
HMCTS acting chief executive, Kevin Sadler, said: "I'm very sorry about your experience at court yesterday - it is totally unacceptable behaviour."
He said he would be investigating the role of his staff and contractors "as a matter of urgency".
"This is not the behaviour anyone should expect and certainly does not reflect our values," he added.
Ms Wilson said she was "grateful" for the apology and hoped it would lead "to some real change".