Malcolm Turnbull has flagged an Australian military presence in Iraq and Afghanistan for the foreseeable future, saying training of local forces needs to be "a long-term commitment".

Speaking on Anzac Day after a meeting with US Defence Secretary James Mattis in the Afghan capital, Kabul, the Prime Minister also said Australia would consider further requests for help in fighting terrorist and insurgency groups in the Middle East.

"There is no doubt that in both theatres there is going to need to be a long-term commitment," Mr Turnbull said at Australia's main base in the Middle East, where he visited Australian troops.

"But it is one of supporting, above all of training, the Afghan and Iraqi security forces – both military and police – to ensure that they have the ability to defend their own country, to push back the terrorists where they've made gains and to secure the territory that the government is holding.