China's new immigration law came into effect on Monday, completing a first major overhaul of border regulations in more than two decades.
"The overriding policy behind the law is to create harsher punishments for foreigners who illegally enter, live or work in China," Gary Chodorow, a Beijing-based lawyer with Frederick W Hong Law Offices, wrote in a paper summarising the new law .
For the first time, the law would detain foreigners between five and 15 days if they were caught residing or working illegally in mainland China.
Although Myanmese, Vietnamese and North Koreans have been regularly detained for illegally crossing China's porous borders, detention of other foreigners in China's hubs for illegal stay or employment has been less frequent.
Illegal migrants would now also be fined 5,000 yuan to 20,000 yuan (HK$6,300 to HK$25,000) and face deportation. Their employers would be fined up to 100,000 yuan per individual illegal employee.
Some 47,100 foreigners were caught violating the immigration law last year, according to data released by the Ministry of Public Security earlier this year.
The new law also aims to reform the green card system, which since 2004 allows foreigners to permanently reside in mainland China. By the end of 2011, only 4,752 people have been granted green cards, called the "hardest to get in the world" by the Southern Metropolis Daily  last year.
Last year China registered 431 million border crossings, 4.7 per cent more than a year earlier. Of those, 54.4 million were foreigners visiting the country, most of whom came from South Korea, Japan and Russia.
About 594,000 foreigners live in China, according to the 2010 national census; most come from South Korea, the US and Japan.
The new law could also ease visa hassles for foreign same-sex couples in China, according to one London-based law firm.
"The new regulations will allow unmarried partners to apply for the dependent resident permit by providing a cohabitation certificate," Newland Chase noted in a blogpost .
The law has, however, not narrowed down the range of options the Ministry of Public Security has in handling foreigners illegally residing on the mainland, Chodorow cautioned.
"It is skeletal in many places, leaving it to administrators to enact implementing regulations and to officers to exercise their discretion," he wrote.
The law replaces the immigration law for foreigners and another for Chinese nationals from 1986. A bill was first submitted in 2003. The National People's Congress approved the law in June last year.