Germany's constitutional court has rejected a challenge to the European Central Bank bond-buying program credited with helping keep the euro currency union from breaking up in 2012.

The court in Karlsruhe said Tuesday that the ECB had not exceeded its legal powers and rejected a challenge from legislators and a citizen's group to the bond-buying program.

ECB President Mario Draghi announced the program in 2012 after promising that the central bank for the 19 countries that use the euro would do "whatever it takes'' to preserve the euro. At the time, bond market turmoil was threatening the finances of several euro countries. The ECB offered to buy bonds of countries facing high sovereign borrowing costs, as long as they submitted to financial reforms.

The program was never used, but the mere existence of an unlimited monetary backstop from the central bank helped lower the borrowing rates for governments struggling with excessive debt, easing the financial crisis. The court decision is a victory for the ECB and its ability to intervene in financial markets on behalf of its interest-rate policy, and a defeat for skeptics who think its stimulus and anti-crisis programs have gone too far.

Opponents had argued that the bond purchase offer violated the European Union treaty's ban on the central bank using its powers to print money to finance governments. The German court had passed the decision to the European Court of Justice, which last year upheld the bond purchase program but imposed conditions, and then returned the case to the German court.

In Tuesday's ruling, chief judge Andreas Vosskuhle said that the German central bank, the Bundesbank, could take part in the bond purchases so long as the conditions specified by the European Court were upheld. Participation by the Bundesbank would be significant, because the ECB relies on national central banks to carry out the bond purchases.

Christoph Schalast, a professor of European law at the Frankfurt School of Finance & Management, said it was significant that the German court signed off on the conditions set by the European court. "I did not think that the court would accept in total the ruling of the European Court of Justice, but this is what happened in this decision,'' he said. "It is a triumph for European integration, because the German constitutional court, the most important constitutional court in the European Union, has accepted the ruling of the European Court of Justice.''

The conditions include a requirement that the ECB let enough time lapse between the issuance of a government bond and the ECB's purchase in the secondary market, so as not to in effect participate in primary issuance. The ECB is forbidden to buy bonds directly from governments, but can acquire them from other investors in pursuit of its interest rate policies.

Bond purchases are a way of affecting market interest rates; if a central bank drives bond prices up, the bond yields — which reflect the interest costs — fall.

The conditions "do not overly restrain'' the bond-buying program, wrote Berenberg Bank economist Holger Schmieding in an emailed analysis.

The 2012 bond purchase program is not overly relevant at the moment, because the ECB has engaged in a different bond purchase program that has driven bond yields down across the eurozone. That program, dubbed quantitative easing, will mean buying 1.74 trillion euros ($1.97 trillion) in bonds through March, 2017. It is aimed at stimulating growth and inflation in the eurozone economy as a whole, not at warding off a crisis in any one country.

Schalast said the court's decision contained stronger legal protection for the quantitative easing program as well, because it sets a high bar for challenges that assert European institutions were overstepping their legal bounds.