One of the men, Nick Andilig, 26, said about 50 militants suddenly appeared in the neighborhood where they were working, shouting “Allahu akbar” and displaying a black flag.

Image Among the Christian civilians trapped by the fighting in Marawi were, from left, Nick Andilig, 26; Ian Torres, 25; and Arman Langilan, 22. Credit... Felipe Villamor/The New York Times

“They claimed to be ISIS out on a mission to cleanse the city,” he said, using another name for the Islamic State. He said he thought that meant they would kill all non-Muslims in the area.

The fighters appeared to be in their 20s, wore face masks and head gear, and carried long firearms, Mr. Andilig said. Some arrived in a police car, which they had apparently stolen.

Mr. Andilig said their employer hid the workers in his basement. When the militants reached his door, the workers overheard him arguing with them. “He told the gunmen that there were no Christians in the house,” Mr. Andilig said.

The militants eventually moved on to the next house. Then they heard shooting.

Mr. Andilig said he did not see the killings, but when he and his group eventually emerged from hiding, they saw several bodies on the ground with what appeared to be gunshot wounds.

“Our employer escaped earlier with another household staff,” he said. “He said he would come back for us but never made it. He was a good Muslim.”

That left the five workers, four men and a pregnant woman, trapped in the house.

For days they subsisted on food the owner had left behind, mostly canned goods and rice, but eventually that ran out. They began to leave the house on brief forays to scrounge for food, eating plants they found.