I will be brief. Essentially, each supporting character questions Hamlet's sanity, and most conclude he is indeed mad.
General consensus can justify almost all actions in most societies.
Hamlet's environment proves no different. Hamlet poses a viable threat to Claudius' throne whether sane or insane, and Hamlet's supposed insanity provides justification for detrimental action. As long as evidence supports Hamlet's psychosis then Claudius can rid himself of Hamlet and rule Denmark as he pleases. Hamlet's actions and speech on numerous occasions can surely support pleas of his insanity. Although Marcellus, Bernardo, and Horatio all witness King Hamlet's ghost, only Hamlet hears it speak.