BRUSSELS (Reuters) - NATO has ended its Indian Ocean counter-piracy mission after a sharp fall in attacks, the alliance said on Wednesday, as it shifts resources to deterring Russia in the Black Sea and people smugglers in the Mediterranean.

All ships and patrol aircraft have now left the area off the Horn of Africa, where they patrolled since 2009, as part of a broader international effort to crack down on Somali-based pirates who had caused havoc with world shipping.

NATO says its "Ocean Shield" operation, as well as European Union and other counter-piracy missions, have significantly reduced attacks, with no ships captured off Somalia since May 2012, down from more than 30 ships at the peak in 2010-11.

After more than a decade of NATO-led operations far beyond its borders, the U.S.-led military alliance is shifting to defend its territory to deter Russia in the east, following Moscow's 2014 annexation of Ukraine's Crimea peninsula.

"The global security environment has changed dramatically in the last few years and NATO navies have adapted with it," NATO spokesman Dylan White said in a statement. "NATO has increased maritime patrols in the Baltic and Black Seas. We are also working to help counter human smuggling in the Mediterranean."

Earlier this month, NATO broadened its operations in the Mediterranean to help the European Union stop criminals trafficking refugees from North Africa.

(Reporting by Robin Emmott)