An operation that killed two al-Shabab militants also killed two civilians and injured three more.