Shanghai has cracked down on foreigners working and living illegally in Shanghai, netting 525 people during a three-month sweep of the city, police said yesterday. Although the crackdown was launched as part of a nationwide campaign that started in April, Shanghai had given the matter special attention because of the rising number of foreigners in the city, a police spokeswoman said. 'This problem must be rectified. Shanghai's legal environment is becoming more complete,' she said. Shanghai has more than 50,000 long-term foreign residents, officials say. A long-term downturn in Asian and other economies and heightened expectations of opportunities from China's entry last year to the World Trade Organisation have brought a flood of economic refugees to the city. Police found 485 cases, including 30 of foreigners working without permits and 18 cases of people entering the city illegally, local media reported. The remaining 437 cases involved foreigners living illegally in Shanghai or failing to process the required residence permits. Police declined to give the nationalities of the people involved. Shanghai typically fines or expels those without valid visas. At the same time, Shanghai has also started to issue a special type of residency permit to foreigners who are individually considered to be valuable to development of the city. Some 265 foreigners and overseas Chinese have received the permits, which allow residence for up to five years without the need to renew visas.