QUITO, Ecuador — A bus apparently lost its brakes, hit another vehicle at high speed and rolled over four times, killing at least 24 people and injuring 22 while smashing into several houses along a highway near Ecuador’s capital early Tuesday, officials said.

The Colombian-registered bus was traveling to Quito when it hit a smaller vehicle in an area known as dead man’s curve at about 3 a.m., authorities said.

Residents described hearing a thundering noise.

Michelle Manay said she woke up and ran outside to see the carnage. “There were some people alive, and others who weren’t,” she said.

Col. Wilson Pavon, the head of Ecuador’s transit police, said most of the passengers were Colombians, but some Venezuelans were also aboard. Three people traveling in the other vehicle also died.