At least 37 people have been killed after a gunman disguised as a tourist opened fire at a Tunisian beach hotel with a weapon he had hidden in an umbrella.

Witnesses of Friday's attack in the resort town of Sousse said the assailant took his time, targeting people at point blank range first on the beach and then around the swimming pool, reloading his weapon several times and tossing an explosive.

British, German and Belgian tourists were among the dead at the Imperial Marhaba hotel, the health ministry said.

The gunman was shot dead by police. Rafik Chelli, a senior interior ministry official, said he was a student, unknown to authorities and not on any watchlist.

Local radio said police captured a second gunman, but officials did not immediately confirm the arrest or his role in the attack.

It was the worst attack in Tunisia's modern history and the second major massacre this year following the assault on Tunis Bardo museum when gunmen killed 22 mostly foreign visitors.

'Easy targets'

Tunisia's government had already stepped up security before the latest attack.

"Now it's talking about more police and military on the ground. But there are thousands of tourist spots and hotels. Many of them are an easy target for someone intent on killing," Al Jazeera's Nazanine Moshiri, reporting from Tunis, said.

Tunisia has been hailed as a model of democratic transition since its 2011 "Arab Spring" uprising and has escaped the worst of the region’s violence.

"It's held free and fair elections. It's political process has been inclusive. Religious and secular parties are in government together. But there are a minority of Tunisians who want a so-called Islamic state here. Thousands of young Tunisians are fighting for armed groups abroad," our correspondent said.

Speaking of the resort attack, Irishwoman Elizabeth O'Brien, who was staying at a neighbouring hotel with her two sons, said there was panic on the beach when gunfire erupted.

"I honestly thought it was fireworks and then when I saw people running... I thought, my God, it is shooting," she told Irish radio station RTE. "The waiters and the security on the beach started to say 'Run, run, run!'"

Six million tourists, mostly Europeans, visited Tunisia's beaches, desert treks and medina souks last year, providing seven percent of its gross domestic product, most of its foreign currency revenues and more jobs than anything but farming.

"This is a catastrophe for the economy," Tourism Minister Salma Loumi said. "Our losses will be great, but the loss of human life was even greater."