Competency hearing
From Memory Alpha, the free Star Trek reference
A competency hearing was a legal procedure required aboard Federation starships in the mid-23rd century when the mental or physical capabilities of a starship's commanding officer came under question.
James T. Kirk was relieved of his command of the USS Enterprise after such a hearing in 2267. (TOS: "The Deadly Years")
