To compare two widely used drug treatments for people with aggression or agitation due to mental illness. Pragmatic, randomised clinical trial. Three psychiatric emergency rooms in Rio de Janeiro, Brazil. 301 aggressive or agitated people. Open treatment with intramuscular midazolam or intramuscular haloperidol plus promethazine. Patients tranquil or sedated at 20 minutes. patients tranquil or asleep by 40, 60, and 120 minutes; restrained or given extra drugs within 2 hours; severe adverse events; another episode of agitation or aggression; needing extra visits from doctor during first 24 hours; overall antipsychotic load in first 24 hours; and not discharged by two weeks. 151 patients were randomised to midazolam, and 150 to haloperidol-promethazine mix. Follow up for the primary outcome was available for 298 (99%): 134/151 (89%) of patients given midazolam were tranquil or asleep after 20 minutes compared with 101/150 (67%) of those given haloperidol plus promethazine (relative risk 1.32 (95% confidence interval 1.16 to 1.49)). By 40 minutes, midazolam still had a statistically and clinically significant 13% relative advantage (1.13 (1.01 to 1.26)). After 1 hour, about 90% of both groups were tranquil or asleep. One important adverse event occurred in each group: a patient given midazolam had transient respiratory depression, and one given haloperidol-promethazine had a grande mal seizure. Both treatments were effective. Midazolam was more rapidly sedating than haloperidol-promethazine, reducing the time people are exposed to aggression. Adverse effects and resources to deal with them should be considered in the choice of the treatment.