The President said that the military had been ordered to deal decisively with anyone found wanting, to end the attacks on rural communities in Nigeria by armed herdsmen.
He gave the warning on Friday while addressing graduating officers who took part in the course 24 of the National Defence College that began in September.
President Buhari also stated that his administration was making efforts to rebuilding the north-east and the Niger Delta to correct the injustices suffered by the regions in the past.
The graduation ceremony was held at the auditorium of the college, with serving and retired military officers, the Emir of Kano, members of the diplomatic corps, the graduating officers and their well-wishers present.
After the arrival of the President, the ceremony began, with graduating officers inducted as fellows of the National Defence College by the commandant of the college, Rear Admiral Samuel Alade.
After the induction, certificates were presented to them by President Buhari, who also presented awards to former commandants of the college and alumni of the college who have excelled in the service of the military and the country.
Part of those that received the awards were former President Abubakar Abdulsami, Vice Admiral Jubrila Ayinla, Major General Chris Garba, the Minister of Defence and the Chiefs of Army, Naval and Air Staff.
While addressing the gathering, President Buhari commended the participants and urged them to do their best to end the attacks on communities by armed persons disguising as herdsmen.