DAKAR, Senegal — Two female suicide bombers detonated explosives on Wednesday morning in an attack on a mosque in northeastern Nigeria, killing 24 people and wounding 18.

The first blast tore through the mosque, and the second occurred near the building a few minutes later in Ummarari, a village outside Maiduguri, the capital of Borno State and a longtime target of the militant Islamic group Boko Haram.

Boko Haram has been terrorizing this part of Nigeria for years and is suspected of carrying out the attacks, according to a statement from Col. Sani Kukasheka Usman, a spokesman for the Nigerian Army.

The militants have been increasingly using suicide bombers — many of them women and girls — to carry out attacks on mosques, markets and other public spaces in recent weeks, as the group shifts away from seizing huge sections of territory. In Wednesday’s attack, at least one of the bombers was dressed as a man, probably to gain better access to the crowds inside the mosque, where women are not allowed in some areas.