MALINDI, Kenya — In a room by the stairs, Shukrani Malingi, a Pokomo farmer, writhed on a metal cot, the skin on his back burned off. Down the hall, at a safe distance, Rahema Hageyo, an Orma girl, stared blankly out of a window, a long scar above her thimble-like neck. She was nearly decapitated by a machete chop — and she is only 9 months old.

Ever since vicious ethnic clashes erupted between the Pokomo and Orma several months ago in a swampy, desolate part of Kenya, the Tawfiq Hospital has instituted a strict policy for the victims who are trundled in: Pokomos on one side, Ormas on the other. The longstanding rivalry, which both sides say has been inflamed by a governor’s race, has become so explosive that the two groups remain segregated even while receiving lifesaving care. When patients leave their rooms to use the restroom, they shuffle guardedly past one another in their bloodstained smocks, sometimes pushing creaky IV stands, not uttering a word.

“There are three reasons for this war,” said Elisha Bwora, a Pokomo elder. “Tribe, land and politics.”

Every five years or so, this stable and typically peaceful country, an oasis of development in a very poor and turbulent region, suffers a frightening transformation in which age-old grievances get stirred up, ethnically based militias are mobilized and neighbors start killing neighbors. The reason is elections, and another huge one — one of the most important in this country’s history and definitely the most complicated — is barreling this way.