The message sent on Twitter was clear: When Nigerian soldiers opened fire on rock-throwing protesters in late October, Nigerian officials swiftly defended them, saying their forces had simply done what President Trump told American soldiers to do in the same situation.
The Nigerian military justified its actions by including a video clip of Mr. Trump’s remarks about migrants heading toward the American border, in which he warned: “They want to throw rocks at our military, our military fights back.”
Nigeria’s defense came after its soldiers had shot at protesters — members of a minority Shiite organization — marching on the outskirts of the capital, Abuja. The military insisted that the soldiers had taken action only after being provoked by the protesters, who hurled rocks at them. Ten soldiers were injured in the melee, it said. The military also said a total of six protesters were killed during marches.
But a close review of video from the largest and most deadly of the protests, as well as interviews with more than a dozen witnesses, clearly shows the military opening fire on unarmed demonstrators, sometimes shooting indiscriminately into the crowd at close range as people turned and tried to flee.
Photos and videos recorded that day show at least 26 bodies. The group said it had collected a total of 49 bodies during four days of protests.
The killings are the latest example of a military that for years has been accused of human rights abuses, with rarely any punishment or action taken, despite President Muhammadu Buhari’s promises to crack down on military violations and restore security in the country.
Since Mr. Buhari came to office in 2015, Nigerian security forces have detained scores of children and babies, raped women living in camps for displaced people and carried out civilian massacres.
Despite the documented abuses, Mr. Trump has strengthened ties with Nigeria. This year, he allowed the sale of warplanes and other equipment to Nigeria that had been blocked by the Obama administration over concerns about human rights abuses.
Before leaving office, President Barack Obama had been prepared to resume the sales. But then the Nigerian military bombed a camp for displaced people, killing dozens of civilians and prompting Mr. Obama to keep the restrictions in place.
Now Mr. Buhari is facing re-election in February, and his critics are pointing to a new unraveling of the security situation across Nigeria that has rattled citizens in all corners of the country.
The Nigerian president has struggled to address a broad range of problems in the military. Its abuses have been carried out not only against protesting Shiites, but also against separatists in the southeast, where the president has launched major military operations. It has used excessive force in the northwest, where he has scrambled fighter jets against gangs roaming the forest.
At the same time, Mr. Buhari’s campaign against Boko Haram, the terrorist group that has been at war with the nation for nearly a decade, has suffered crippling failures on the battlefield.
In recent weeks, more than 100 Nigerian soldiers have been killed in at least 20 attacks against military installations, one of which was captured on video and posted online by a Boko Haram faction.
Parts of neighboring countries that have been peaceful for years have suffered attacks by militants, who have emerged armed from their new victories with heavy military equipment confiscated in raids.
Soldiers fighting Boko Haram have complained of low food rations, shoddy equipment and no days off in more than a year, the local news media has reported.
On Friday, the military suspended the operations of Unicef in the areas most affected by Boko Haram, saying that the organization trains and deploys spies to help Boko Haram because it offered programs to help spot human rights abuses by the military. The military later rescinded the suspension.
Mr. Buhari recently traveled to the war zone to rally troops, but he has yet to address the military abuses.
The shooting deaths of Shiite marchers six weeks ago generated little outrage in the country. Mr. Buhari did not condemn the killings, nor did his rivals.
The president’s “turn-a-blind-eye approach has bolstered the military’s culture of impunity,” said Matthew Page, a former top expert on Nigeria for the State Department.
“Nigerians’ growing frustration with insecurity — whether it be kidnapping, armed robbery, communal violence or terrorist attacks — outweighs the disgust they feel about human rights abuses by security forces,” he said.
Officials have taken a tougher stance against the Shiite marchers, who belong to a group called the Islamic Movement in Nigeria, than it has against almost any other organization in the country.
Nigeria is a mix of Christians and Muslims, but officials say the group is financed and influenced by Iran. Most Muslims in Nigeria, including Mr. Buhari, are Sunni. The group does not believe the Nigerian Constitution applies to it — largely because its members do not feel protected by the rule of law. That sentiment has angered officials.
The military said it had killed three people who were blocking the road and trying to steal military equipment, and then another three at the Oct. 29 march who were throwing fuel bottles and large rocks at soldiers.
But the video from the march clearly contradicts those claims. The melee began that day as more than 1,000 marchers approached a military checkpoint. Soldiers arrived to block off the road. An armored vehicle with high-caliber weapons patrolled the highway. After soldiers began to fire, they targeted protesters fleeing the chaos. Many of the injured were shot in the back or legs.
Brig. Gen. John Agim, the spokesman for the Nigerian military, said soldiers had abused no one during the recent marches. He said he had not seen video of the events but was certain that whatever existed had been manipulated to make Nigerian soldiers look bad, calling it “stage managed.”
The protesters from the group generally “cause a lot of disruption,” he said. “They destroy other people’s cars. They block the traffic.”
“When they attack the military, what do you expect soldiers to do?” he said, adding that the military had retrieved weapons from protesters, including knives and homemade firebombs. “Of course, there will be a necessary course of action.”
Amnesty International disputed the military’s statements, saying its allegations against marchers were an attempt to justify unlawful killings. The military’s actions appear to violate international laws, according to Human Rights Watch, which said that Nigerian officials had a pattern of repressing the Shiite group.
Muhammed Sani said he had watched soldiers shoot to death one of his brothers, who had attended the Oct. 29 protest with him, and later learned that another brother had also been killed. He said he had lost friends that day, too.
“Our protests are peaceful, but they kill us anyway,” he said.
The Islamic Movement in Nigeria, founded about four decades ago and inspired by the Iranian Revolution, has been repeatedly labeled a terrorist threat. In the city of Kaduna, where many of the members live, the group is barred from protesting or assembling. Its places of worship, schools and community centers have been demolished by officials who say the group wants to spark a Shiite revolution and could turn to terrorism.
The recent killings are the latest in a long history of clashes, including a more deadly episode in 2015, when soldiers opened fire on members of the group blocking a road for a religious ceremony.
Nearly 350 people were killed, their bodies buried in a mass grave, and the group’s leader was imprisoned. He is still in jail on terrorism charges, despite a federal court order demanding his release.
Many of the marchers on Oct. 29 were protesting his detention.
On a recent visit to a hospital in Abuja, more than 40 injured protesters, all in their late teens or 20s, lay on thin mattresses in a dimly lit ward.
Umar Shittu, a 20-year-old student from Kaduna, sat silently on a bed stained by damp blood and urine, rocking back and forth, his face badly drooped. A bullet had pierced the top of his skull and lodged in his neck.
Fatima Muhammed Sani, 16, was also wounded. She had trailed her mother on many marches in the past and was in the middle of the crowd at the Oct. 29 march when she heard gunfire. She said she had run and suddenly felt a strange sensation in her left thigh. A bullet had fractured her bone. Her movement is likely to be restricted forever.
“If I could walk right now, I would go back to protest again,” Ms. Sani said. “I’m ready to sacrifice my life for my leader.”
New York Times