Outgoing American Ambassador John Berry has warned that free countries like the United States and Australia must be vigilant against undemocratic meddling in their political systems.

Mr Berry was responding to a question about Chinese political donations and "soft power" influence in Australia, but he also broached the risk of interference by Russia, North Korea and Iran in the US.

Mr Berry also offered effusive praise for Australia's electoral system, saying he would "try to take home with me" compulsory voting, a time limit on election campaigns and independent drawing of electoral boundaries to stop manipulation known as "gerrymandering".

The Ambassador, who is due to finish up his three-year stint in about a month, told an audience at the National Press Club in Canberra that non-democratic countries were influencing democracies through ownership of media and in some cases cyber attacks.