How old do you have to be to a mental institution?

thats a trick question!!depending on the mental stability and age of the person,id say 17,anyone younger would be cared for untill adulthood,and a progression report would be done,no inprovement by age 17 institution is the only thing left