Christian militias stormed a U.N. base in southern Central Africa Republic early on Monday, killing one peacekeeper and wounding 11, the United Nations said.
At around 5 a.m. (0400 GMT), armed anti-balaka militants attacked the base in Tagbara, about 300 km (190 miles) northeast of the capital Bangui, a U.N. statement said.
The ensuing gunfight lasted hours, and 22 anti-balaka were also killed, the statement said.
Later in the morning, peacekeepers discovered 21 dead civilians, including four children, near a church in Tagbara. It was not immediately clear who was responsible for those deaths.
"Nothing can justify such acts that can be considered war crimes," the statement said. "An investigation will be conducted and will leave no room for impunity."
Central African Republic was torn apart after mainly Muslim Seleka rebels ousted president Francois Bozize in 2013, provoking retaliation killings by the anti-balaka.
A 12,000-strong U.N. peacekeeping mission has struggled to restore order to the countryside where attacks on civilians are frequent. The U.N. Security Council approved an extra 900 peacekeepers in November to help to protect civilians.
The mission has become a deadly one: more than a dozen U.N. peacekeepers were killed there last year.