Japan had fewer foreign residents as of the end of 2021, down 4.4 percent from a year before, apparently due to its tighter border controls amid the coronavirus pandemic, official data showed Tuesday.

The number stood at 2,760,635, marking the second yearly decline, with that of technical interns and international students dropping 27.0 percent and 26.0 percent, respectively, according to the data released by the Immigration Services Agency of Japan.

The number of permanent residents, the largest group of foreigners permitted to stay in the country, increased 2.9 percent to 831,157, the agency said.

By country and region, people from China accounted for the most at 716,606 followed by those from Vietnam at 432,934.

By prefecture, only Yamanashi and Shimane among Japan's 47 prefectures saw a slight rise in the number of foreign residents, while Tokyo hosted the largest number of them with 531,131, followed by Aichi, Osaka, Kanagawa and Saitama.

Foreign nationals who were ordered to be deported and sent back home for violating Japan's immigration law fell 1,328 from a year before to 4,122 as many flight services were discontinued due to the effects of the pandemic.

By nationality, Vietnamese led others in the number of those who were deported at 1,781.

Japanese authorities, meanwhile, granted 4,174 provisional releases of violators from detention facilities, up 1,113, as part of efforts to prevent the spread of the coronavirus.

The official data do not include the number of diplomats and special permanent residents, among other categories of foreigners living in Japan.

Special permanent residents are ethnic Koreans and Taiwanese whose families lost Japanese citizenship but remained in the country after World War II.