Militant Islamist group al-Shabab says it was behind the attack which killed at least six people and wounded one in north-eastern Kenya.
The militants threw a grenade before opening fire in a residential area in Mandera town, police said.
Mandera County governor Ali Roba confirmed the casualties, adding that security guards had saved 27 people.
Al-Shabab is headquartered in Somalia, and has carried out a string of attacks in neighbouring Kenya.
- Africa Live: More on this and other stories
“We have suffered another sad attack,” Mr Roba said in a tweet.
The raid took place in the early hours of Thursday in an area popular with people who came from outside Mandera town, reports the BBC’s Ferdinand Omondi from Kenya.
- Why is al-Shabab targeting Kenya?
- Who are Somalia’s al-Shabab?
- Rivalry among East Africa’s militants
- Al-Shabab: A defector’s tale
“From the nature and style of the attack, it will obviously be al-Shabab,” Mr Roba told Reuters news agency.
“If not for the quick response by our security forces, we would be talking of many more casualties now.”
Al-Shabab has been at war with Kenya ever since Kenyan forces entered Somalia in October 2011 in an effort to crush the al Qaeda-linked militants.
Kenyan troops are now part of the African Union mission in Somalia fighting the group.