The number of foreign nationals who lived in Japan as of the end of 2017 grew 7.5 percent from a year earlier to hit a record high of 2,561,848, reflecting a jump in Vietnamese residents, the Justice Ministry said Tuesday.

The ministry also said the number of residents whose visa status was illegitimate as of Jan. 1 this year rose 1.9 percent to 66,498, up for the fourth consecutive year. That figure was also attributed to a surge in people from Vietnam.

Of those with legal residence status — long-term residents and permanent residents — 7,668, up a sharp 105.1 percent, held visas designated for highly skilled professionals, such as researchers and engineers.

Among the legal residents, those from China increased 7.5 percent from the previous year to 730,890, accounting for 28.5 percent of the total.

South Koreans came second at 450,663, followed by Vietnamese at 262,405, up 31.2 percent, and by Filipinos at 260, 553, which slipped from last year’s third place.

Those from the United States increased 3.7 percent from a year earlier to 55,713, making up 3.7 percent of the total.

South Koreans topped the list of overstayers at 12,876, followed by Chinese at 9,390 and Thais at 6,768. Illegal Vietnamese residents numbered 6,760.

Year-on-year growth in the number of Vietnamese nationals living in Japan exceeded 30 percent both in terms of legal and illegal residency, according to the data.

The ministry also said it deported 13,686 foreign nationals in 2017, up 2.4 percent in the third straight year. Of the total, 9,134 were working illegally, with 2,213 in Ibaraki Prefecture.