Doctors and teachers working in immigration detention facilities could face up to two years in prison if they speak out against conditions in the centres or provide information to journalists, under sweeping new laws to gag whistleblowers.

The Border Force Act, which was passed quietly on May 14 by both major parties, clamps down on "entrusted people" in detention centres recording or disclosing information about conditions in centres such as those on Nauru and Manus Island.

Under the heading of "secrecy and disclosure provisions", the act says releasing information is only permitted by the secretary of the department responsible for detention centres.

"Under the proposed measures, the unauthorised disclosures of information, including personal information will be punishable by imprisonment for two years," it says. The new law will be enforced in July in conjunction with the official merger of the Immigration and Customs departments.