Coincidence or not the Turnbull has chosen just the moment when Labor is flailing over allegations of improper connections with a Chinese billionaire to introduce new laws dealing with political donations and espionage.

Against the background of continuing political fallout for Labor Senator Sam Dastyari over inappropriate dealings with a Chinese political donor, the government has unveiled two sets of legislation that seek to address concerns about the source of political donations and attempts to influence the political process.

What is not clear is whether these pieces of legislation have been hastily brought forward to take advantage of the Dastyari affair. This will be tested when these laws are debated in parliament in the new year.

Central to the new legislation will be a law that makes it a criminal offence for a foreign entity or its representatives to interfere in Australian politics.

“If you act covertly on behalf of a foreign actor, in a way that harms Australia’s national security, to influence the political process, or a government decision, that conduct will be criminalised,’’ Attorney-General George Brandis said.

It remains to be seen how such a broad-ranging measure would be prosecuted. It aims to shield Australia from the sort of interference that is bedeviling other Western democracies.

The government is making no secret of having drawn lessons from the United States in drafting its legislation, including experiences during the 2016 presidential election.

In another important component of the legislation aimed at combating foreign influence, it will be an offence not simply to communicate sensitive information, but to possess such information gained improperly.

In the other tranche of legislation announced yesterday, the government will ban all foreign donations to political parties, and those organisations like the progressive lobbying group GetUp, which seek to influence the political process.

Again, the government will face challenges defining exactly which groups are engaged in influencing the political process on left and right, and their sources of funding.

Finally, the requirement for lobbyists operating on behalf of foreign entities to register should be regarded as a welcome development. Such lobbyists, including former Trade Minister Andrew Robb who represents a Chinese company, will now find themselves on the public record.