Japan is considering detaining some asylum seekers once their visas expire in an attempt to curb what it calls abuse of its refugee system, drawing criticism from lawyers who say such measures risk causing humanitarian harm.

Exchange students and foreign trainees who apply for asylum may be held in immigration detention centers once their visas expire, Yasuhiro Hishida, a justice ministry official overseeing asylum recognition, said Friday.

Currently, people with valid visas who apply for asylum receive six-month, renewable permits that allow them to stay and work in Japan while their applications are reviewed.

The proposed crackdown, which comes after asylum seekers soared to a record high last year, will clamp down on what is effectively a system of back-door immigration that has allowed companies to hire cheap migrant workers.

Labor demand is at a 43-year high here as the population shrinks and barriers for blue-collar workers remain high. This has spawned a “gray” labor market, especially in the construction and manufacturing sectors, which hire asylum seekers from countries such as Turkey and Bangladesh, Reuters investigations found.

Hishida said many job seekers claim asylum to get work permits.

“Foreigners who want to work in Japan find out they’re allowed to work while their asylum applications are reviewed, and this has led to the rise in abuse and misuse of the refugee system,” Hishida said.

Immigration lawyer Chie Komai said the move could see legitimate asylum seekers locked up.

“There are exchange students whose political activity in Japan makes it dangerous for them to return home, and those who study in Japan waiting for the danger of persecution to wane,” Komai said.

In 2016, a record 10,901 people from countries such as Indonesia, Nepal and the Philippines sought asylum in Japan, justice ministry data showed. The government accepted just 28 of these.

Last year, 1,106 trainees applied for asylum — roughly a 26-fold increase from 43 in 2012. The number of asylum-seeking exchange students multiplied nearly 14 times in the same period, to 1,399 in 2016 from 102 in 2012.

Curbs on residence and work permits for exchange students and trainees who seek asylum will start as early as July, the daily Yomiuri Shimbun reported Friday.

But Hishida said the government is still considering various steps to curb abuses of the asylum system and has yet to decide on which measures to implement and when.

Lawyers and activists say exchange students and foreign trainees, who are allowed to work for a set number of hours or period of time, often become targets of exploitation.

Violations among groups accepting foreign trainees hit a record last year, government data showed.