Prime Minister Malcolm Turnbull was en route to Washington from Afghanistan when a rocket hit a compound next to the palace he had visited hours earlier.

Mr Turnbull was at the palace in Kabul on Sunday to meet with Afghanistan President Dr Ashraf Ghani.

Reuters said the rocket landed inside the Italian embassy and injured two guards.