A U.S. soldier is in custody after at least 16 people - including women and children - were allegedly shot to death in their sleep in villages near a military outpost in the Panjwai district of southern Kandahar early Sunday.

U.S. President Barack Obama offered condolences to the grieving families of those killed and to the people of Afghanistan.

Obama called the attack "tragic and shocking" and not representative of "the exceptional character of our military and the respect that the United States has for the people of Afghanistan," in a statement released by the White House.

One U.S. official said the soldier was an Army staff sergeant from Fort Lewis, Wash., and it's believed he acted alone. Initial reports indicated he returned to the base after the shooting and turned himself in.

An official who spoke to The Associated Press on condition of anonymity said the soldier was assigned to assist either a special operations unit of either the Green Berets or Navy SEALs.

"This is an assassination, an intentional killing of innocent civilians and cannot be forgiven," Afghan President Hamid Karzai said in a statement.

Afghan officials said nine children and three women were among the dead.

The shooting comes at a rough time for relations between the U.S. and Afghanistan.

U.S. soldiers inadvertently burned Muslim holy books last month at a military base outside Kabul that sparked riots that left dozens dead, including six American troops.

The violence spurred calls in the U.S. for a faster exit strategy from the 10-year-old Afghan war.

Obama said recently that "now is the time for us to transition." But he also said he had no plans to change the current timetable that has Afghans taking control of security by the end of 2014.

Sunday's attack began around 3 a.m. in two villages in Panjwai, a rural suburb of Kandahar and a traditional Taliban stronghold where coalition forces have fought for control for years.

The villages -- Balandi and Alkozai -- are about 500 metres from a U.S. base.

Villagers say the person entered as many as three different homes and started shooting at residents.

"I heard gunshots and then silence and then gunshots again," recalled Abdul Baqi who lives in Alkozai.

Karzai's statement sparked some confusion about the number of shooters witnesses reported seeing.

After first mentioning a lone gunman, Karzai later refers to "American forces" entering the homes. He also quotes a 15-year-old boy named Rafiullah, who told him in a telephone call that "soldiers" entered his home in the dead of night and opened fire on his family. Rafiullah was reportedly shot in the leg.

Other villagers said they suspected that more than one gunman was at work, given the death toll.

"One man can't kill so many people. There must have been many people involved," said Bacha Agha of Balandi village. "If the government says this is just one person's act we will not accept it. ... After killing those people they also burned the bodies."

Canada's Defence Minister Peter MacKay has denounced the shooting spree as deplorable and "contrary to everything that the international mission to Afghanistan aims to accomplish."

In a statement issued Sunday, MacKay said the incident will not deter Canada and its allies from completing duties in the country.

"The good work of our men and women in uniform, as well as the work of many fearless Canadian civilians, continues to bridge what Afghanistan is and what Afghanistan can be," he said.

Lt. Gen. Adrian J. Bradshaw, deputy commander of the International Security Assistance Force, said authorities are working to punish whoever is behind the rampage.

"I cannot explain the motivation behind such callous acts, but they were in no way part of authorized ISAF military activity."

Reports of protests in Panjwai began to surface shortly after the shootings. U.S. travellers in Kandahar have been told to be cautious.

The American embassy in Kabul issued a statement denouncing the rampage and any attack by a member of the U.S. Armed Forces against civilians.

"We are saddened by this violent act against our Afghan friends," the statement reads. "Our thoughts and prayers are with the families and their entire community."

Karzai said the nation is still expected to forge a partnership deal with the United States in May.

The agreement would cement the U.S.-Afghan relationship and the military's role in Afghanistan after NATO transfers responsibility to Afghan security forces at the end of 2014.