Phew. Oil's roller-coaster quarter is over.

Prices plunged to their lowest point in 13 years, and then rose 42% in just over three weeks. In the end, prices ended the quarter pretty much where they started it -- just under $40 a barrel.

Some of the wild swings were driven by politics, others by mere words.

Saudi Arabia cuts ties with Iran

Oil was sent on its first wild ride of 2016 after Saudi Arabia cut diplomatic and commercial relations with Iran.

Both countries are key oil producers and the diplomatic spat showed just how hard it would be for the rival producers to cooperate to support oil prices.

Related: Oil prices 'may have bottomed out'

China fears

Chinese markets started the year with several unexpected plunges that rattled investors and drove down oil prices.

The volatility and weaker economic data coming from China fueled concerns about slowing oil demand from the world's biggest net importer. That could exacerbate the epic supply glut that caused crude to crash in the first place.

Oil plunged to as low as $26.21 in January, the lowest point since 2003.

Iran sanctions lift

The end of economic sanctions against Iran caused another slump in oil prices in mid January. Iran has been gearing up for this moment for months and wants to return to the top ranks of global oil producers soon.

Iran was hoping to ramp up production by 500,000 barrels a day immediately after sanctions lifted.

However, production data showed Iran's output increased by just 220,000 barrels a day in February, which brought some relief to oil prices.

Related: For Iran, oil exports matter more than price

Saudi Arabia and Russia agree oil freeze

Prices got an additional boost in February on signs that some big oil producers might cut production. Saudi Arabia and Russia agreed to freeze production at January levels, provided other countries sign up too.

However, the agreement later fell apart, and both Russia and Saudi Arabia ramped up their oil production in February. And the prices slid again.

Hidden force behind oil's rise: sabotage by terrorists

Huge spike on "hopes"

Oil jumped back above $40 per barrel in mid-March. The milestone marked a dramatic 54% spike in the span of just five weeks, but left analysts baffled. That's because the surge hasn't been fueled by any significant improvements in the balance between supply and demand.

It's been based on hopes that OPEC and other producers would agree to freeze production when they meet in Doha next month.