Psychiatry and law: how are they related?

Psychiatry and law: how are they related?