Tanzanian opposition legislator Tundu Lissu is recovering in a Kenyan hospital after being wounded in a gun attack at his residence in Tanzania's administrative capital, Dodoma, according to his party.

Abdallah Safari, the vice president of main opposition party CHADEMA, said at a news conference on Friday that Lissu was taken to the Aga Khan hospital in neighbouring Kenya's capital, Nairobi, "after a decision by his family and his party".

"His health is improving," he said.

Vincent Mashinji, CHADEMA secretary-general, said: "Those who wanted to kill him have failed."

The motive for the shooting by unknown gunmen was unclear.

READ MORE: Tanzania: Opposition MP Tundu Lissu wounded by gunmen

Lissu, 49, was attacked at his home in Dodoma on Thursday, after returning from a parliamentary session.

He was shot in the stomach and leg, according to local media reports, with party spokesman Tumaini Makene describing his condition as "critical".

According to party leaders, Lissu had previously complained to being "tailed" by a car and repeatedly said he feared assassination.

"Party members are afraid," Safari said.

Police said on Thursday they had opened an investigation.

Rights groups, Tanzania's government and others have condemned the shooting.

In a statement, President John Magufuli's ruling Chama Cha Mapinduzi (CCM) party also condemned "this cruel and inhuman act".

Magufuli tweeted that he was "shocked to hear the news of the attack on Tundu Lissu and I pray to God almighty that he will soon recover".

Government critic

Lissu has had a series of run-ins with Magufuli's government, and has been arrested at least six times this year, accused of insulting the president and disturbing public order, among other charges.

He serves as chief whip for the parliamentary opposition and is president of Tanzania's bar association, the Tanganyika Law Society, as well as being CHADEMA's attorney general.

His most recent arrest was in August, after revealing that a plane bought for the national carrier had been impounded in Canada over unpaid government debts.