Eager faces filled the dingy hospital ward’s windows, craning for a glimpse of the alleged terrorist. The police had brought him in a few hours earlier, saying he and a friend had been examining some explosives that detonated prematurely. The blast had killed the friend and left the 25-year-old Mohammed Ahmed too badly injured to flee the scene. Now, flanked by police officers with assault rifles, he lay on a rickety iron bed in the northern Nigerian city of Kaduna, enduring the whispered taunts of strangers, blood seeping through the bandages on his deeply burned legs. He insisted he had nothing to do with bombmaking and was only keeping his friend company. The police saw it differently. “We think he was part of a team,” a detective standing nearby explained, over the din of excited children. “We went into the house. We saw everything: wires, batteries, pliers, chemicals. They were making them there. This was a network ... a terrorist organization.”

Until recently, few people outside Nigeria had ever heard of Boko Haram. Even among Nigerians, the terrorist group’s obscure aims, together with the general incompetence of young militants like Ahmed—who got himself blown up this past April—led most people to regard it as little more than a nuisance. No longer. For the second Christmas in a row, the group unleashed a series of highly coordinated church bombings, wreaking mass carnage on holiday services. The attacks, evidently designed to provoke broader violence between the country’s Christians and Muslims, left more than 50 dead and capped a year in which the ultrasecretive Islamist movement transformed itself from a local oddity into an organization capable of undermining the precarious unity of Africa’s most populous nation.

Boko Haram—the name translates loosely from the Hausa language as “Western teaching is forbidden”—has been at war with police in its northeastern home states since 2009, but in the past year the group has brought its bloody attacks right to the nation’s capital, Abuja. In the run-up to this past April’s national elections, the militants bombed party offices and assassinated office seekers seemingly at will in the Muslim-dominated north. In June, they managed to detonate a bomb inside the heavily guarded national police headquarters, and in August, a suicide bomber plowed an explosive-laden car through two security barriers and into the lobby of the United Nations’ offices in Abuja, killing 23 people and wounding more than 80. FBI experts, brought in to help with the investigation, found that the vehicle had been packed with precision shaped charges, carefully arranged to inflict maximum damage.

Boko Haram’s rapid advances in terrorist technology and its use of suicide bombers, previously unheard of in Nigeria, have fed suspicions that the group may now be receiving outside support. There have long been rumored links to the Algeria-based Al Qaeda in the Islamic Maghreb, and a report published by the U.S. House of Representatives Subcommittee on Counterterrorism and Intelligence late last year suggested that Boko Haram may have also begun collaborating with Somalia’s Al-Shabab. “We are in a position now like the United States was in after 9/11,” declared Nigeria’s defense minister, Bello Haliru Mohammed, in the wake of the U.N. bombing. The comparison is now axiomatic among the country’s political leaders, seeking to portray the violence as one more front in the Global War on Terror. But the violence that threatens to engulf the country has sprung from within—and that could prove even more dangerous for Nigeria and its neighbors.

As the year-end winds off the Sahara shroud the setting sun with dust, Abdurrahman Musa can only hope there will be lights tonight at the Quranic school in Kaduna where he teaches. “Electricity will come today, I think,” he says. A few minutes later, as if in response to his indomitable optimism, a single exposed lightbulb dangling from the ceiling suddenly flickers to life. It’s a lucky night for the school. As often as not, the building is left in the dark, and his young pupils have to crowd around kerosene lamps to copy their evening verses.

A few years ago the school integrated the national certified curriculum, after nearly a century of teaching nothing but Islamic theology. Now it offers several hours of math, science, and English every day. But despite reforms that are supposed to prepare students for the modern world, Musa says the prospects for his young charges are grim. Many, he believes, will likely find their way into the ranks of criminal gangs or radical movements like Boko Haram. “This problem is not religious,” he says. “It is a social problem. All the companies have been shut down due to the lack of electricity. It’s very difficult for the youth to find jobs. They have nothing to do.”

It’s a nationwide problem. Despite Nigeria’s status as Africa’s largest exporter of crude oil, with daily production exceeding 2 million barrels, the country’s 160 million people are among the world’s most impoverished. The opaque distribution of petroleum revenue has encouraged corruption on such an epic scale that 80 percent of Nigeria’s oil wealth ends up in the pockets of just 1 percent of the population, according to the World Bank. Petroleum exports, which account for fully 40 percent of the country’s GDP, provide almost no jobs for Nigerians. The disastrous shift from agriculture and light manufacturing to an oil-based economy has hit hardest in the predominantly Muslim north, where government neglect of critical infrastructure has led to the wholesale shuttering of traditional industries.

In a futile attempt to mask the gravity of the problem, the National Bureau of Statistics actually lowered the poverty line to roughly $200 a year in its most recent comprehensive study on Nigerian living standards. But even by this reduced standard, well below the internationally accepted level, more than half of all Nigerians were living in poverty. In the north, the figure was a staggering 72 percent.

Amid such a perfect storm of deprivation, corruption, and worsening marginalization, support has grown for Boko Haram’s blanket rejection of secular authority. “How can you go to a place and bomb it and kill people and then call it Islamic? It is, of course, not condonable,” says Khalid Abubakar Aliyu, the secretary-general of Jama’atu Nasril Islam. For years the group, an umbrella organization representing Nigeria’s theologically diverse Muslim population, has emphatically dissociated itself and Muslims in general from Boko Haram. “But a hungry man is an angry man,” Aliyu says. “This is really the problem.”

As Boko Haram has gained ground, moderate Muslim leaders have urged rapid action to remedy longstanding social grievances in the north. That’s the only way the country can permanently eliminate the threat of Islamic extremism, they say. Nevertheless, President Goodluck Jonathan, a Christian from the south, has pursued a hardline military strategy. Early last year, in an effort to deny the insurgents a secure base from which to operate, he deployed thousands of federal troops to northeastern Nigeria and placed all federal, state, and local security personnel in the region under military command. And the push continues. An astounding 20 percent of the country’s recently announced 2012 federal budget is devoted to security and defense.

Boko Haram’s fighters have responded in kind, launching almost daily hit-and-run raids on government forces and then quickly melting back into the population. Unable to engage the elusive enemy directly, Nigerian soldiers have targeted civilians like the family of Ali Bukar. This past September, the 57-year-old man was just returning home from evening prayers in Maiduguri, the capital of Boko Haram’s native Borno State, when a roadside bomb exploded near a passing military patrol. “The soldiers just came in shooting,” Bukar says. “My eldest son was selling gasoline on the side of the road when he was shot and killed. His brother ran to help him, and he was also hit by three bullets.” The younger son survived, but Bukar says soldiers torched the family’s house along with dozens of others in the neighborhood as they went door to door, looking for insurgents. And when the family went to the morgue to retrieve the eldest son’s body for burial, soldiers there refused to hand it over. “They wouldn’t release it until we signed a paper saying he was a member of Boko Haram,” says Bukar. “It took us six days to get his body back.”

Far from crushing Boko Haram, the Army’s brutal tactics have become a powerful recruiting tool for the group. A few worried Nigerians like Borno’s governor, Kashim Shettima, are urging the government to change course before it’s too late, but so far they’re in the minority. “For now it is largely confined to this part of the world,” he tells Newsweek. “But it has the capacity to become a conflagration that might consume the whole of the north. You can bring in 200,000 armed personnel, and they can accomplish nothing. This is a city of 3 million people. You have to win the hearts and minds.” In a place like Nigeria, that won’t be so easy.