A surprising force has helped lift oil prices back to the $50 threshold: militants blowing up oil facilities in Nigeria.

The recent wave of sabotage on Nigeria's oil infrastructure has knocked nearly 1 million barrels of daily production off line, adding to the country's financial stress and dethroning it as Africa's biggest producer. Nigeria's oil production plunged to an average of 1.4 million barrels a day in May, its lowest monthly pace since the late 1980s, according to the U.S. Energy Information Administration.

The attacks, carried out by a militant group known as the Niger Delta Avengers, combined with wildfires in Canada to deliver a powerful one-two punch to world oil supplies. Now the huge surplus that sent crude crashing to $26 a barrel in February appears to be fading, with oil nearing a balance between supply and demand.

The EIA cited the flurry of global oil supply outages as the main driver behind oil's rise in May. Not only did these disruptions ease the supply glut, they've dashed fears of overflowing storage tanks.

Related: Nigeria was drunk on oil

What happens in Nigeria will play a big role in global oil prices going forward. The Niger Delta Avengers have destroyed oil wells and pipelines including ones owned by Chevron, which could take months or longer to repair. The militant group has refused to negotiate with the Nigerian government and even threatened to slash Nigeria's oil production to zero, though it's not clear it has the ability to do so.

"Output could stay low for years if there is no ceasefire," Thomas Pugh, commodities economist at Capital Economics, wrote in a note.

That's what happened when Libya went through a civil war in 2013 that destroyed much of the OPEC nation's oil capabilities. Three years later, Libya continues to suffer from daily outages of about about 1 million barrels, according to EIA estimates.

Nigeria had an energy crisis and gasoline shortage even before the recent spate of violence. Following decades of poor maintenance, mismanagement and corruption, Nigeria's four state-owned refineries are operating at just 5% capacity. That means frequent power outages and long lines at gas stations.

Now Nigeria is grappling with "widespread disruptions to key crude streams," that include Forcados, Bonny Light, Qua Iboe, Brass River and Escravos, according to Societe Generale. All outages except the ones at Qua Iboe, which was recently restored, have been due to attacks from the Niger Delta Avengers.

Nigeria's oil region "remains engulfed in a security crisis," Helima Croft, head of commodity strategy at RBC Capital Markets, wrote in a report. "A key problem is that the Nigerian military remains relatively weak and under-equipped after decades of poor funding and training."

Related: Can this massive refinery solve Nigeria's energy crisis?

The militant group is angry over the loss of land in the Niger Delta, the country's biggest oil producing region, and is demanding that revenue from the area be distributed more fairly. The group launched a similar wave of violence from 2006 to 2009. That crisis was only resolved after the Nigerian government offered the militants an expensive package that included the amnesty, job training and cash payments, analysts said.

Tensions reignited earlier this year after the cash-strapped Nigerian government slashed funding for that program by nearly three-quarters.

"Given that the group is refusing to talk to the government, it seems likely that there will be further acts of sabotage against oil infrastructure," said Pugh.

-CNNMoney's Eleni Giokos and Logan Whiteside contributed to this report