Three Chinese nationals were charged with hacking into the private email accounts of major US law firms and helping themselves to juicy tips on upcoming mergers.

The trespassing trio then used the tips to trade stocks of the companies pegged for acquisition to earn a nifty — but very illegal — $4 million in profits in less than two years, it is alleged.

One of the three men — 26-year-old Iat Hong from Macau — was arrested on Christmas Day after he dared set foot in neighboring Hong Kong, which has an extradition treaty with the US.

Hong currently is in custody awaiting extradition proceedings to the US.

The other two men — Bo Zheng, 30, of Changsha, China, and Chin Hung, 50, of Macau — remain at large.

All three were charged Tuesday in a 13-count federal criminal indictment and sued civilly by the Securities and Exchange Commission.

The feds said the men learned about the still-confidential mergers by hacking into the computers of seven law firms.

Info was taken from two firms, it is alleged.

In one deal, the men allegedly learned in the summer of 2014 that an unnamed pharmaceutical company wanted to buy rival InterMune for $67 a share. Although that deal fell apart, InterMune’s shares hit $74 after it was bought by Roche.

Hong and Zheng earned more than $393,000 trading InterMune’s stock in the weeks leading up to the Roche merger announcement, the feds said.

The alleged cyberthieves also got advance warning in 2015 of Intel’s $16.7 billion deal to buy chip maker Altera. They made a whopping $1.4 million trading Altera’s stock ahead of the deal becoming public, it is charged.

The men are also accused of hacking into a US-based robotics company in an effort to steal “proprietary and confidential schematic designs of a robotic vacuum.”

The hacked law firms were not named, but firms involved in the deals cited by prosecutors include Cravath Swaine & Moore and Weil Gotshal & Manges, which the Wall Street Journal had reported were hacked earlier this year.

Hong was charged on nine counts, including conspiracy and securities fraud. He faces a maximum 110 years if convicted.