Hundreds detained as Indian caste protest turns violent