Julia Gillard's former media adviser John McTernan regularly used obscene language when communicating with the prime minister's staff, thousands of emails leaked to the ABC show.

The emails highlight Mr McTernan's aggressive management style, which regularly disintegrated into foul language, and also reveal the inner workings of Ms Gillard's office.

Former prime minister Julia Gillard with communications director John McTernan. Credit:Alex Ellinghausen

In one email, Mr McTernan directed staff to carry out research in the parliamentary library for former Labor leader Mark Latham, to thank Mr Latham for publicly describing Kevin Rudd as a lunatic. The parliamentary library is only for the use of members of Parliament and their staff.

Mr McTernan fashioned himself as a real-life version of the foul-mouthed Malcolm Tucker, from BBC satire In the Thick of It, and it appears the similarities extended beyond the shared Scottish accent.