Media playback is unsupported on your device Media caption The BBC's Orla Guerin spoke to Gen Musharraf on his flight from Dubai to the port city of Karachi

Former Pakistani President Pervez Musharraf has arrived back in Pakistan, ending four years of self-imposed exile and defying death threats.

A protection detail of heavily armed commandos met him after his plane from Dubai touched down in Karachi airport. A mass rally in the city was cancelled.

General Musharraf plans to lead his party in the May general election.

Meanwhile, 17 soldiers were killed by a suicide bomber in the north-west of Pakistan overnight.

They were attacked at a security checkpoint in the tribal region of North Waziristan, close to the Afghan border and a known stronghold of the Taliban and al-Qaeda-linked militants.

A recent Taliban video threatened Gen Musharraf with snipers and suicide bombers.

At the scene Gen Musharraf moved through the aisles of the plane - greeting supporters, shaking hands and having his photo taken to the bemusement of regular passengers. There were chaotic scenes with journalists scrambling over seats as the journey became a mini campaign rally. Gen Musharraf told the BBC he felt emotional about returning to Pakistan, but he said he had mixed feelings because of the risk to himself and his supporters. When the plane landed, his supporters on board cheered and shouted "Long live Pervez Musharraf".

He faces a string of charges including conspiracy to murder, but on Friday the Pakistani authorities granted him protective bail in several outstanding cases, freeing him from immediate arrest once he sets foot in Pakistan.

One of the charges is that he failed to provide adequate security for opposition leader Benazir Bhutto after she returned from exile in 2007.

Two deadly explosions, in which nearly 140 people died, greeted her arrival in Karachi on 19 October. She was killed that December at a rally in Rawalpindi.

'Like a wedding party'

About 1,500 Musharraf supporters gathered near the airport in Karachi, the BBC's Orla Guerin reports.

Earlier, the former leader, 69, tweeted a photo of himself aboard the plane, writing: "Settled in my seat on the plane to begin my journey home. Pakistan First!"

In Dubai, the smiling general told our correspondent the event felt like a wedding party.

A group of about 200 supporters and journalists saw off the former military ruler - including party members from the UK, Canada, Switzerland and the US.

Image copyright AFP Image caption Armed police guarded the airport

Some of the general's supporters wore white armbands saying they were ready to give their lives for him.

The planned mass rally in Karachi was called off because the authorities had withdrawn permission.

The former military leader has lived in London and Dubai since stepping down five years ago. He left Pakistan in 2009.

He has vowed to return several times in the past, but those previous attempts have been abandoned.

'Tanker blaze'

There was no immediate claim of responsibility for the attack in North Waziristan, in which 34 soldiers were reportedly also injured.

A car packed with explosives blew up next to a pair of fuel tankers at the check post, intelligence officials told AP news agency on condition of anonymity.

The blast set the tankers on fire and nearby military living areas were destroyed, they said.

Janan Dawar, an eyewitness who lives about 14km (nine miles) away from the checkpoint, said he had heard a huge explosion and had seen flames leap into the air.

Three civilians were also injured.

It appears that most of the soldiers targeted had been working in road construction, part of the army's strategy for winning hearts and minds locally.