Thu Dec 25, 2014 4:03pm EST

By Abdi Sheikh and Fiesal Omar

MOGADISHU (Reuters) - Eight Islamist gunmen infiltrated the main African Union (AU) base in Mogadishu on Thursday and killed three peacekeepers and a civilian contractor, the AU mission in Somalia said.

Somali militant group al Shabaab claimed responsibility for the attack, which lasted several hours, and said it had killed 14 peacekeepers. Witnesses reported hearing bomb blasts and volleys of gunfire through the day.

"We targeted the enemies at a time they were celebrating Christmas," Sheikh Abdiasis Abu Musab, al Shabaab's military operations spokesman, told Reuters.

In the past, al Shabaab has exaggerated the number of soldiers it has killed, while officials have played down losses.

The al Qaeda-aligned militants want to topple the Western-backed Mogadishu government and describe AU troops as "Christian enemies". The Islamist group also wants to impose its own strict version of sharia law in the country.[More]