system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: The idea of “mental competence” in or in avoidance of court cases.

How is it determined whether someone is mentally capable of standing trial in court, and what is the underlying idea behind stopping/altering a case for those reasons? 

Also what happens to a case where the defendant has been found to be incapable of standing trial?
gpt
> How is it determined whether someone is mentally capable of standing trial in court,

Anyone can call into question the defendant's competency to stand trial. Ultimately the judge makes the decision. If the judge rules that there is a legitimate concern, they can hold a hearing to determine competency. They can call for psychological evaluations, but the judge still makes the final call.

> and what is the underlying idea behind stopping/altering a case for those reasons?

American citizens have a right to competent defense, to address their accusers and call witnesses for their defense. They cannot do this if they are incompetent.

> Also what happens to a case where the defendant has been found to be incapable of standing trial?

The trial will be postponed and the defendant held under mental observation and evaluation till such a time as they become competent.