Japan had fewer foreign residents as of the end of 2021, down 4.4% 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% and 26.0%, respectively, according to the data released by the Immigration Services Agency.

The number of permanent residents, the largest group of non-Japanese permitted to stay in the country, increased 2.9% 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.

Vietnamese nationals accounted for the most number of deportees, at 1,781.

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

The official data does not include the number of diplomats and special permanent residents, among other categories of non-Japanese living in Japan.

Special permanent residents refer to ethnic Korean and Taiwanese residents whose families remained in the country after World War II, despite losing their Japanese citizenship.