* Al Qaeda-linked Somali Islamists claim attack
* Al Shabaab demanding withdrawal of Kenyan troops from Somalia
* Stand-off in supermarket after mass shooting
* President loses relatives in raid, vows to punish attackers
By Duncan Miriri and James Macharia
NAIROBI, Sept 22 (Reuters) - Kenyan security forces were locked in a stand-off on Sunday with gunmen who killed at least 39 people at an upmarket shopping mall in the Kenyan capital, and it was still unclear how many hostages the al Qaeda-linked militants were holding.
The Somali Islamist group al Shabaab claimed responsibility for Saturday's assault on Nairobi's Westgate mall, which is frequented by Westerners as well as Kenyans.
Kenyan President Uhuru Kenyatta said more than 39 people had been killed, among them close members of his own family. A senior government official said on his Twitter feed that more than 300 people had been wounded. The dead included children and the wounded ranged in age from two to 78.
France said two of its citizens were dead and Canada said two Canadians had died, including a diplomat. The U.S. State Department said it had reports that American citizens had been hurt, and Britain said its nationals had undoubtedly been affected.
Police said the stand-off was focused around the Nakumatt supermarket, one of Kenya's biggest chains, where the attackers were said to be holding hostages.
Kenyatta said the security forces were engaged in a "delicate operation" with the top priority being to safeguard the lives of people caught up in the incident, but it was unclear how many were still trapped inside the building.
Al Shabaab, which has links to al Qaeda and is battling Kenyan and other African peacekeepers in Somalia, had repeatedly threatened attacks on Kenyan soil if Nairobi did not pull its troops out of the Horn of Africa country.
The raid presents Kenyatta with his first major security challenge since a March election victory. Kenyatta has vowed to defeat the militants who have said it is time to shift the war to Kenyan soil.
"We have overcome terrorist attacks before," he said.
The mall assault has been the biggest single attack in Kenya since al Qaeda's east Africa cell bombed the U.S. embassy in Nairobi in 1998, killing more than 200 people. In 2002, the same militant cell attacked an Israeli-owned hotel at the coast and tried to shoot down an Israeli jet in a coordinated attack.
The major attack on an iconic mall that draws tourists, expatriates and Kenya's wealthy elite like a magnet risks hammering an already struggling tourism sector and could puncture Kenyatta's plans to boost east Africa's biggest economy's reputation as a sound investment destination.
Al Shabaab's last big attack outside Somalia was a twin attack in neighbouring Uganda, targeting people watching the World Cup final on television in Kampala in June 2010.
Kenya sent its troops into Somalia in October 2011 to pursue the militants it blamed for kidnapping tourists and attacking its security forces.
Relatives of hostages thought still to be trapped inside the Westgate mall were keeping vigil in a nearby Hindu centre, waiting for the next move by the security forces.
Kevin Jamal said his sister was taken hostage while shopping at the mall, and he had been waiting for more than six hours.
"I want her to come out alive," Jamal told Reuters as he joined Kenya Red Cross Society volunteers for a meal of hot curry and chips served by the centre.
He said the Kenyan security agencies could have done better, saying "they should not allow themselves to be outmanoeuvred by less than 20 people."
Police say it is not clear how many attackers they are dealing with, and those rescued said at least one of the attackers was a woman. One of the attackers had been shot and arrested, but died shortly afterwards at a hospital.
A fierce gun battle erupted between the police and the militants after Saturday's initial assault. The shooting continued hours after the first attack and soldiers then managed to enter the building, hunting for the attackers shop by shop.
Witnesses said the attackers were armed with AK-47 rifles and wore ammunition belts.
There was a lull in activity in the hours after midnight. Troops were milling around at the mall, near two armoured personnel carriers and two big fire trucks, one with a long, extendable ladder.
Music was still playing and a video screen was on at a gourmet burger shop. Journalists and curious bystanders were moved out of the mall onto a side road.
Al Shabaab appeared to taunt the security forces, saying on its official Twitter handle @HSM_Press that there would be no negotiations whatsoever with Kenyan officials over the standoff.
"10 hours have passed and the Mujahideen are still strong inside #Westgate Mall and still holding their ground. All praise is due to Allah!", the group said.