Man loses bid to leave nursing home, is made ward of court