© Associated Press
Tripoli, Libya: A Ghanaian teacher cowers in his house, certain he will be grabbed at a checkpoint because of his dark skin. Armed rebels detain 19 Ukrainian cooks and oil workers for several days on unsupported claims that they are really snipers for Moammar Gadhafi.

They're among thousands of foreigners caught in a web of suspicion as rebel fighters pursue the remnants of Gadhafi's forces. Gadhafi hired some foreigners as mercenaries, but many others held ordinary jobs in Libya, and the rebels who ousted the Gadhafi regime from most of Tripoli last month often seem to make little effort to tell them apart.

"How can we be snipers?" cook Maksim Shadrov asked angrily at a training center for oil workers in Tripoli where he, his wife and 17 other Ukrainians were being held.

"They are old. She is a woman. We are not snipers," he said, pointing to some members of his group. Even a rebel commander conceded that he had no evidence to the contrary, but held them nonetheless, despite a diplomat's efforts to free them.

In rebel-run Tripoli, people with dark skin - even Libyans - are at risk because Gadhafi is known to have recruited soldiers from sub-Saharan Africa.

"Every black is a target," said Tony Biney, the Ghanaian teacher, who stayed home with his wife for two weeks before risking a trip to church.

There have been widespread arrests and frequent abuse of migrant workers since the rebels seized Tripoli late last month, Human Rights Watch said Sunday, but did not give an estimate of the number of detainees. The group said the clampdown created "a grave sense of fear among the city's African population."

A rebel official estimated that some 5,000 people have been detained since rebels seized Tripoli. At one makeshift detention camp, conditions for Libyan detainees were acceptable, but sub-Saharan Africans were held in overcrowded cells with a putrid stench, Human Rights Watch said. The detainees complained of a lack of water and poor sanitation.

The detentions have created an image problem for the rebel leadership, which relies heavily on Western support and has pledged to build a new Libya based on the rule of law, in contrast to Gadhafi's brutal regime.

The harsh treatment could also cause problems for the rebels as they attempt to rebuild Libya's economy, which has depended heavily on foreign workers to keep up with its oil boom. However, the draw of steady, well-paid employment may in the end be stronger than the fear of mistreatment.

Before the six-month civil war that brought down Gadhafi, hundreds of thousands of foreigners filled jobs Libyans didn't want or weren't trained for, including in construction, oil and health services. Data is sketchy, but some estimates say at least 1.5 million foreigners worked in Libya, a country of just 6 million.

The workers are mainly Africans, Asians and Eastern Europeans, lured from economically depressed countries by Libya's relatively high wages.

Hundreds of thousands of them fled Libya after the outbreak of fighting in February, many complaining at the time that they had not been paid or were robbed by Gadhafi troops on the way to the border. Others were either unable or unwilling to leave.

On Sunday, Human Rights Watch called on the rebels to stop arbitrary arrests and to set up a system to review cases of people alleged to be mercenaries. The New York-based group said it has evidence that the Gadhafi regime recruited hundreds of mercenaries from Chad, Sudan and other countries - but noted that cannot serve as the basis for mass arrests.

The rebel leadership "has legitimate concerns about unlawful mercenaries and violent activity, but it can't simply arrest dark-skinned men just in case they think they might be mercenaries," said Sarah Leah Whitson of Human Rights Watch.

The rebels' National Transitional Council has called on fighters not to abuse prisoners and says those accused of crimes will receive fair trials.

In one sign of possible change, an official for the U.N.'s main refugee agency, Sam Cheung, said several dozen Somalis were released to his group Sunday.

"We are hoping this is a model, a first transaction," Cheung said.

The Philippines sent a senior diplomat to give some 1,700 Filipino workers, mostly nurses, the option of leaving. A government official said four Filipino housemaids who worked for a Gadhafi relative will take the offer.

Some workers said they hadn't been harassed by either side in the war. Others, including some of the Ukrainian detainees, planned to stay in Libya despite receiving rough treatment.

"As you know, life in the Ukraine is bad," said Shadrov, the cook. "We came here to earn money for our family."

The Ukrainians, hired by the Russian-Libyan oil company Dakara, arrived in Tripoli in July. After the rebels entered the capital on Aug. 21, the Ukrainians were detained by rebel fighters, handcuffed and moved to various locations, Shadrov said.

"They took everything from us," he said. "Money, passports, computers, everything."

Othman bin Othman, the rebel commander in charge of the oil workers' training center, initially said the Ukrainians were armed and trained as snipers, but changed his account after reporters interviewed the detainees.

"To be very honest, we didn't find any weapons in their houses or on them, but they arrived into the country illegally and during a very sensitive time - after the war," he said. "This led us to believe they were working for the enemy."

Diplomats from Russia and Ukraine visited the group, and Shadrov's father, a Russian citizen, was able to leave.

At a meeting with the rebels, the Ukrainian consul was asked to bring back a written promise that if the Ukrainians are allowed to leave the detention center, they will stay in their homes and not leave the country without proper documentation.

Some of Gadhafi's real mercenaries, meanwhile, have already left.

Mohamed, a migrant worker from Mali, said he came to Libya in 2007 and found work in restaurants and as a gardener.

Speaking in the Mali town of Bamako, he said he briefly joined a pro-Gadhafi militia after the outbreak of the uprising, and was sent to try to crush rebels in the port city of Misrata, a stronghold of the revolt. He said he stopped fighting after a couple of weeks and returned to Mali.

Mohamed did not give his last name because he said did not want anyone to know he fought for Gadhafi. He said he still has family in Libya and has not been able to get in touch with them for more than two weeks.

Biney, the Ghanaian teacher, and his wife, a housekeeper, said they will stay in Libya. They need the money.

They're continuing to keep a low profile, but left their home Friday to make a quick dash to St. Francis Catholic Church in downtown Tripoli. They hired a driver for $90, a steep sum, they said, since they haven't worked or been paid for six months.

They did it, Vida Biney said, to say a prayer of thanks for surviving the war.

"We are alive. We are grateful to God," she said.