BBC reporter Anne Soy: "These are the first suspects to appear before court in connection with the Westgate attack"
The four foreigners have been charged with aiding terrorist groups and being in Kenya illegally. Their nationalities have not been disclosed, but they are said to be ethnic Somalis.
These are the first charges to be brought in relation to the four-day September siege. Those charged have been named as Mohammed Ahmed Abdi, Liban Abdullah, Adnan Ibrahim and Hussein Hassan. "The accused persons carried out a terrorist attack at Westgate Shopping Mall on 21 September by supporting a terrorist group," the charge sheet read.
The police say the four accused had sheltered the attackers in their homes in Eastleigh - a Somali neighbourhood in Nairobi - and that they were in contact with the gunmen four days before the siege. All four, who had no lawyer, have pleaded not guilty to the charges, which also included obtaining false identification documents. None of the men is accused of being the gunmen in the centre.
The court has ordered them to be remanded at a local police station after the prosecution asked for more time for further investigations.
The Somali militant Islamist group al-Shabab said it carried out the attack. The Kenyan army has said that all four of the attackers died during the siege. One of the suspected attackers has been named as 23-year-old Somalia-born Norwegian national, Hassan Abdi Dhuhulow.