On a road littered with burned-out tanks and teeming with rebel soldiers, a white bus trundled west this week, women and children waving excitedly from its windows.

It had been three weeks since Col. Moammar Gaddafi’s forces had shelled their town, sending them fleeing to tents in the desert. Now, a day after Libyan rebels had retaken their town, they were going home.

But it was not the home they had left behind.

“They destroyed everything,” Bashir el-Maghreby, 25, said on Monday as his shoes crunched over broken glass inside his father’s two-story house. The furniture was gone, the refrigerator door ripped from its hinges, a basket of eggplants still inside. The rooms smelled of feces.

Although he knew government troops had occupied the town, “we didn’t think it would be this bad.”

For the past five weeks, as the Libyan front line has repeatedly shifted from east to west and back again, the people who live along the coastal road that forms the war’s central artery have ridden a rollercoaster of hope and terror.

Earlier this month, town after town fell to the government’s forces, blasted by air, land and sea. Survivors told of missiles that landed directly on homes or mosques, and dead bodies strewn through city streets. Thousands of Libyans packed up belongings and sped east toward Egypt, unsure if they would see their homes again.

After coalition airstrikes around the contested city of Ajdabiya, rebels this weekend pushed westward, retaking that city as well as the oil towns of Ras Lanuf and Brega. On Tuesday, the front line swung back in the government’s favor, with rebels retreating eastward. But by then, some families had already ventured back to their homes to see what remained.

Saleh Kelani, 48, opened his front gate to an ominous sight: His white Toyota SUV had large bullet holes in its door frame and front windshield.

Inside, intruders had strewn a jumble of clothes, photos and other belongings onto the floor. The shelves were stripped almost bare, with only a few glass vases remaining. The money Kelani’s family had kept in a bedroom was gone, as was his wife’s gold.

“They even stole my fishing poles,” he said. “I like to fish, and hunt hawks, and they also stole my nets and binoculars.”

But all that paled next to what else was missing: his oldest son, 24, also named Saleh, who had stayed behind when the rest of the family fled.

“My son said, ‘Let me protect our house and also the car,’ ” Kelani said.

After Kelani left, he had some cellphone contact with his son.

“He was telling me that the house is being bombed, there were a lot of missiles, and a lot of shells. He was really scared,” he said. “That was really hard for me to hear.”

Kelani shrugged and put his arms out. “To me it’s not really a big deal losing the gold and the money, but finding him . . . ” He dropped his arms and began to sob.

But if the pro-Gaddafi troops brought mayhem to some parts of the previously rebel-held areas, the damage was not uniform. In Brega, 77 miles to the east, Abdel Karim bin Taher, 63, refused to leave when the Libyan army came.

“He needs his bed,” he said, gesturing toward his son Abdullah, 28, a paraplegic whose adjustable hospital bed commands a prime spot in the living room.

And so bin Taher, who works in an oil company’s purchasing department, and his six teenage and adult children, spent a surreal 15 days alone in their home town.

Only the father, a tall, placid man who wears a long white robe and has a single gold tooth, dared to leave the house. He would go to the oil company, where the cafeteria was being run by Gaddafi’s forces, and they would give him pasta and rice to take home. With chicken and meat in the family freezer, they were able to eat.

Electricity continued to function, and a satellite dish in the front yard allowed the bin Tahers to track the war.

“Sleep, television, sleep, television,” said the eldest son, Tamim, 30, with a grin. “And PlayStation.”

On Saturday, a day after coalition airstrikes pushed Gaddafi forces out of Ajdabiya, Tamim heard a car on his street for the first time in two weeks.

He ran out to see what it was, and recognized a rebel soldier who had gotten to know the family before the rebels were routed.

“He came to check on us,” Tamim said. “Oh, I was very happy, and I hugged him, because before that I was very, very, scared.”

Venturing out, he found that the homes in his area of Brega were mostly intact. Unbeknownst to his family, four other families had also stayed, and a few more were starting to trickle in.

The fighting was by no means over, however, and on Monday night the rebels were pushed back to Bin Jawwad, just 37 miles west of Ras Lanuf, raising the possibility that the oil towns could change hands again.

Maghreby and Kelani and their families did not stick around to find out. Maghreby loaded the women and children, some of them crying, back onto the bus to return to the desert, and Kelani followed soon after.

But in Brega, at least temporarily, Tamim was free to be outside again. He climbed into his pickup truck and waved from the driver’s seat, then took off along the scrubby dunes that hug the Mediterranean Sea.