Hundreds of villagers fled their homes in the northern Indian state of Uttar Pradesh on Tuesday after three days of bloody sectarian clashes left at least 38 people dead and dozens wounded, including small children.

The fighting between Hindus and Muslims in the area, the worst in years, was sparked by a violent dispute between two families of different faiths last month, authorities said. A Muslim youth was killed by two Hindu men after he allegedly sexually harassed their female cousin. The two were then attacked by a Muslim mob and lynched in reprisal, officials said.

On Saturday, tens of thousands of sword-wielding Hindu villagers defied curfew orders and attended a massive public meeting, at which they called for justice. Police said some politicians at the meeting gave incendiary speeches against Muslims. Officers have arrested 366 people for allegedly rioting and inciting hate.

“There is no safety in the villages, because everybody is burning with the desire for revenge right now,” said Mohammad Hashim, 41, a driver who transports groceries in his village of Johra. “It is easier for the police to control violence in the cities, but in the villages, there is so much fear now. You fear your own shadow. You think someone may be hiding in the farm. You think your neighbor is plotting to kill you.”

Although no violence was reported Tuesday in the district of Muzaffarnagar, about 80 miles northeast of New Delhi, villagers in the area said they feared that clashes could spread to rural hinterlands, where policing is said to be inadequate. Thousands of police officers and regular and paramilitary soldiers patrolled the towns for a third day and conducted door-to-door searches for miscreants and weapons.

Brij Bhushan Sharma, a senior police officer, told the television news agency ANI that his team is going to the villages and holding public discussions with residents in an effort to reduce tensions.

Vikas Kumar, a 25-year-old farmer, said he was returning home with about 30 villagers on tractors after attending the public meeting Saturday when some Muslims along the route began throwing bricks at them.

“We got out of our tractors and ran for our lives, but they attacked us with swords,” Kumar said in a phone interview from his hospital bed in Muzaffarnagar. “My brother and I have got injuries on our head, legs, arm and waist. I have never seen such frenzy in my lifetime.”

The last time the area faced such riots was in 1992, when violence raged across India after the demolition of a 16th-century mosque by Hindu radicals who said it had been built by Islamic invaders over a sacred Hindu temple.

The latest clashes fueled fears of religious tension roiling campaigns ahead of national elections in eight months. The politically significant state of Uttar Pradesh is considered a tinderbox, and sectarian conflicts are on the rise as the controversial Hindu nationalist leader Narendra Modi is set to be named as his party’s candidate for prime minister.

Political parties have begun accusing one another of inciting violence as they try to consolidate their voter bases.

Anger was inflamed further when a video purportedly depicting a lynching went viral on social-media sites and was forwarded en masse via cellphones. Police, who later said that the video was fake, charged a local Hindu politician with promoting religious enmity, saying he had posted the video on his Facebook page.

“I also received that video on my cellphone,” said Kumar, the farmer. “It made me very angry.”

Police lifted the curfew in riot-scarred neighborhoods for two hours Tuesday. But many people said fear remains palpable in the villages.

On Monday, Hashim’s cousin Mehrajuddin was walking back from his guava orchard when he was surrounded by a group of unidentified men and stabbed with a “sharp weapon,” Hashim said.

The police found his body on a dirt track outside the village.

“Ironically, the killing took place a day after the elders of the Hindu and Muslim communities in our village sat together in public and promised to protect each other,” Hashim said in a telephone interview as he sat outside the police mortuary in Muzaffarnagar, waiting for the postmortem report.