Pakistan’s defence minister has flown to Riyadh for talks over whether to join the Saudi-led military campaign to oust the Houthi rebels from Yemen.

Khawaja Asif was accompanied by other top military and civilian officials for the meetings in the Saudi capital on Tuesday that came amid a storm of controversy at home over the prospect of Pakistan becoming involved in the conflict.

The country has been agonising for days over a dilemma that balances the need to keep a key ally happy against the risks of getting embroiled in a fight that could exacerbate sectarian strains in Pakistan and distract from the country’s fight against its own militant groups.

The prospect that Islamabad could send troops emerged last Thursday when Saudi Arabia announced that it had agreed to join the coalition of Muslim states, which includes Egypt and Kuwait, aiming to stem the advance of the Houthi forces that have seized large swathes of Yemen.

The foreign ministry immediately denied the claim and said the country was still considering its options – which Asif repeated on Tuesday.

Yet there have been persistent reports that Pakistan will become involved and that some military assistance from its navy and air force may already have begun.

The prime minister, Nawaz Sharif, who lived in Saudi Arabia after he was ousted in a military coup in 1999, has made hawkish statements on the crisis.

On Tuesday, Sharif said Pakistan “considers the security of the holy land of the utmost importance”. He also warned that “violation of the territorial integrity and sovereignty of Saudi Arabia would evoke a strong reaction from Pakistan”.

Pakistan’s army has a long tradition in getting involved in overseas conflicts to assist key allies in the Arab world, and already has nearly 300 troops in Saudi Arabia for a training exercise.

Pakistani troops fought in the 1967 Six-Day War between the Arab states and Israel. The army also came to Saudi Arabia’s aid in 1969 when South Yemen invaded part of the kingdom.

Saudi Arabia, with its oil wealth and custodianship of Mecca, Islam’s holy city, is an especially important country for Pakistan, which last year received $1.5bn (£1bn) in aid from the kingdom.

It is also home to two million Pakistanis who remit some of their earnings to families at home – a vital source of foreign income for the cash-strapped country.

However, Pakistan must also maintain good relations with Iran, a country with which it shares a border.

Many analysts believe the regional struggle between Iran and Saudi Arabia is being played out inside Pakistan where there has been a growing number of sectarian attacks by Sunni militants on Shia mosques and communities.

The perception that Tehran is backing the Houthi power grab in Yemen is likely to inflame the situation in Pakistan, said Mushahid Hussain Syed, the head of the foreign relations committee in the Pakistani senate.

He said: “Sending troops to fight in a Yemeni civil war, which is now also a Middle East proxy war, would be folly of the highest order.

“It would be tantamount to undermining our own national interests because it would detract from our own campaign against extremism and terrorism.”

The main political parties appear to be split on the issue. Imran Khan, the leader of the Pakistan Tehreek-e-Insaf, has warned against going to war, saying Pakistan should offer its services as a mediator instead.

However, on Monday, Asif Ali Zardari, the country’s former president who controls the opposition Pakistan Peoples party, said it was the “collective responsibility of the international community to join hands against” the Houthi forces.

Religious groups have also diverged, with Shias calling for Pakistan to stay out but some radical Sunnis, including the suspected terrorist leader Hafiz Saeed, staging demonstrations to show solidarity with Saudi Arabia.