An adviser to the European Court of Justice says the European Central Bank's offer to purchase government bonds of troubled countries is "compatible in principle" with the EU treaty.

The bond purchase program helped calm market turmoil that threatened to break up the euro currency union when it was announced in 2012 but never implemented.

Opponents in Germany challenged the program in court. They say the ECB overstepped its authority and violated an EU ban on the central bank directly bailing out governments.

Markets have been watching the case in part because the ECB is considering a broader bond purchase program aimed at stimulating the economy.

The opinion Wednesday from advocate general Pedro Cruz Villalon is preliminary before a decision by the court's judges later this year.