The fight against militants in the north has unintentionally spread violence, Muhammadu Buhari says.