Justin Bieber lost his cool under oath Thursday, when a lawyer started peppering him with questions about Selena Gomez ... TMZ has learned.
Bieber sat for a 4 1/2 hour deposition in Miami in connection with a lawsuit filed by a photog who claims last June Bieber sent his hired muscle to beat him up.
The contentious lawyer for the bodyguard drilled Bieber on a variety of subjects, but things spun out of control when Selena Gomez was raised.
The lawyer started asking if Selena was present during any incident involving fights with photogs. Bieber's lawyer, Howard Weitzman, felt the lawyer was just trying to get a rise so he objected. But the lawyer persisted and asked again ... Bieber was fuming and Weitzman jumped in and said his client was being harassed.
The photog's lawyer asked about Selena again, and at that point Justin and Weitzman stood up and left, and as Justin was leaving he screamed, "Don't ask me about her, do not ask me about her!"
Five minutes later they returned but things got even hotter. At one point Bieber responded to a question with the word "Yeah." The lawyer said, "Do you mean yes?" To that Bieber responded, "What the f*** is the difference between yeah and yes?!"
A short time later Bieber fired back, "What is this, "60 Minutes?" At another point he responded to a question by saying to the lawyer, "OK Katie Couric, what's your question again?"
And even TMZ got in the act. The lawyer showed Bieber multiple TMZ posts, and the singer accused the lawyer of having an obsession by constantly surfing TMZ for Bieber stories.
And finally ... the lawyer asked Bieber if he has a prescription for Xanax, and Bieber responded, "No."