BEIRUT, Lebanon — Thousands of foreign laborers turned themselves over to the authorities in Saudi Arabia on Sunday to be sent to their home countries after a night of protests and clashes in which one foreigner and one Saudi were killed.

The protests were directed against a Saudi campaign to arrest and deport illegal immigrants who were given until last week to get valid work permits or leave the country. In recent days, the security forces have raided the work sites of large employers of foreign laborers and the neighborhoods where they live to round up violators.

Saudi Arabia and other oil-rich Persian Gulf nations have long relied on large numbers of foreign laborers from Africa, Asia and elsewhere to keep their economies running by doing jobs like driving taxis and building skyscrapers as well as staffing hospitals, schools and universities.

Human rights organizations have accused the gulf countries of failing to protect the rights of foreigner laborers, many of whom pay large placement fees to get jobs and surrender their passports to those sponsoring them once they arrive.