Iraq is pumping oil faster than it ever has.

The country's oil production hit an all-time high in June at 4.1 millions of barrels of oil per day, according to the International Energy Agency. Iraq's oil surge is remarkable considering the uphill battle it's fighting.

"Already in 2015, OPEC's second-biggest producer has made huge strides to expand output despite the twin challenge of low oil prices and a costly battle against" ISIS, the IEA noted.

Iraq has suffered heavily from the global decline in oil prices. A year ago, the government pulled in about $300 million per day in revenue. Now it's down to roughly $240 million a day. The surge in production hasn't compensated for the fall in oil prices, but the government benefits the most from a production boost, experts say.

The price of a barrel of oil has slid below $51 this week, matching lows last seen in April.

"What they lost in price significantly exceeds the production growth," says Fadel Gheit, managing director of oil and gas research at Oppenheimer & Co.

Related: Oil prices dive below $51 as Iran deal looms

The Islamic State continues to commandeer many of Iraq's oil rigs, robbing the Iraqi government of much-needed oil money. ISIS controls about 10% of Iraq's oil fields. However, ISIS has to sell its oil at a discount because it must go to the black market for buyers.

Now the Kurdish Regional Government, which controls some oil production in northern Iraq, is trading less oil with the national government over payment disputes, IEA reports.

Add on the possibility of the United States reaching an agreement with Iran, which could make oil prices go down further, and it's clear to see that Iraq's challenges are steep.

"Despite all these obstacles, despite all these problems...we still have 4 million barrels a day of Iraqi production. If that was under normal circumstances, Iraq would've been close to 4.5 to 5 million barrels," says Gheit.

But as Gheit and the IEA point out, Iraq's current production level won't be permanent.

The government has already told major oil companies that run its southern oil fields, like ExxonMobil (XOM), that they need to slow production later this year. U.S. companies don't stand to win or lose much since they don't own the oil fields there -- they're only paid a service fee by the government, experts say.

With ISIS claiming more and more oil fields, Iraqi officials are planning budget cuts, which will curtail oil production later this year.