NEAR SABARIMALA TEMPLE, India — As a woman and a man climbed a steep trail on Thursday leading to one of Hinduism’s holiest temples, a mob multiplied with frightening speed.

From a point farther up the path, several hundred men screamed at the woman, insisting that she immediately turn back from visiting the Sabarimala Temple, a centuries-old shrine in southern India. When the pair of visitors, both journalists for The New York Times, decided to descend, the crowd rushed at them, hurled rocks and pummeled two dozen police officers.

“Madam, you don’t be afraid, O.K.?” Habeeb Ullah, one of the police officers, told one of the journalists, a bit too late.

For centuries, women of childbearing age were prohibited from entering the temple, which is perched on a lush hill in the coastal state of Kerala. Last month, after India’s Supreme Court struck down that ban, saying that barring women from the temple infringed on their constitutional rights, thousands of protesters pledged that women who dared to visit the temple would be punished.