The UK will Wednesday step in to prevent takeovers and corporate deals by China and other foreign companies that have the potential to endanger national security, it said.

The change is the UK's most sweeping corporate intervention measure for almost 20 years.

Set to be published Wednesday, the National Security and Investment Bill will allow ministers to examine and intercede in foreign investments and give them powers to block acquisitions any time within five years following the conclusion of a deal.

According to UK Business Minister Alok Sharma, the law will mean "we can continue to welcome job-generating investment to our shores while shutting out those who could threaten the safety of the British people," Reuters quoted the official as saying.

The law will allow the UK to address long-standing concerns that some corporate deals could bring disrepute by indiscreet or reckless behavior and compromise security or vital economic infrastructure, Sharma said.

Earlier this year, British ministers stopped China communications company Huawei from parts of the UK's communications system over worries about surveillance. In 2016 Britain deferred nuclear power projects in England because of concerns about government funding from China.

Conservative backbenchers said they wanted to look deeper into the proposed legislation and were considering revisions to make it easier to avert takeovers by foreign entities accused of being involved in human rights violations.

The new law will require companies to seek permission for any potential deal - from acquisition to sale of assets and intellectual property - involving a host of sectors, like transport, energy, artificial intelligence and defense.

British regulators have been careful to impose the new measure in a country-neutral manner but though there are worries about Russian entities, it is takeovers involving China companies that they will examine most closely.

Contraventions of the law might be fined and executives might be sentenced to prison. Any dealings where notification is regarded as compulsory will be declared invalid if certain requirements are not met.