ISTANBUL (Reuters) - Turkey's deputy prime minister said on Wednesday a military build-up on the border with Iraq was a precaution, not a threat, and urged the government in Baghdad to lower tensions after it warned Turkey would pay for any incursion.

A convoy of Turkish tanks and other armored vehicles are advancing toward the town of Silopi, near the Iraqi border, their deployment coinciding with an Iraqi operation to drive Islamic State from the northern city of Mosul.

Largely Sunni Muslim Turkey fears that Iraqi Shi'ite militias involved in a related offensive west of Mosul could trigger sectarian unrest, and is also concerned that Kurdish PKK militants are trying to establish a foothold nearby.

Iraqi Prime Minister Haider al-Abadi warned on Tuesday that Baghdad would respond to any violation of its territory.

"We are obliged to take measures to guard against threats from across Turkey's border," he added. "It is more of a precaution than a threat."

Abadi said his country did not want war or confrontation and that the "door of diplomacy" was open, but added:

"If they enter, we are ready to face them ... Any invasion of Iraq would lead to the dismantling of Turkey."

Turkish Defence Minister Fikri Isik said on Tuesday that the deployment was part of the fight against terrorism and that Turkey had "no obligation" to wait behind its borders if PKK militants gained a foothold in Iraq's Sinjar region, around 115 km (70 miles) south of Silopi.

Silopi is part of Sirnak province, one of the main areas of conflict between Turkey and the PKK, whose main bases are in the mountains of northeast Iraq. The PKK has been fighting for autonomy in Turkey's mostly Kurdish southeast for three decades, and is designated a terrorist group by the United States and European Union.

But Ankara is also concerned about an offensive by Iraqi Shi'ite militias, backed by Iran and known collectively as the Hashid Shaabi (Popular Mobilisation Forces), to recapture the Iraqi town of Tal Afar, west of Mosul, from the Sunni militant group Islamic State.

Erdogan has said Ankara will respond if the militias "cause terror" in Tal Afar, home to a large ethnic Turkmen population with historical and cultural ties to Turkey.

Abadi said Tal Afar had a mixed population with a majority of Turkmens, both Shi'ite and Sunni, and that any force sent to recapture it from Islamic State would reflect that diversity.