Islamist militants killed nine Nigerian soldiers in an attack on a military base in the northeast of the country, three soldiers and an official from a security agency said on Wednesday.