South Carolina's top court on Thursday ordered Governor Mark Sanford, a fierce critic of President Obama's economic stimulus program, to take $700 million in federal stimulus money.

The state Supreme Court's ruling likely ends a months-old dispute between the Republican governor and the state legislature, which had already incorporated the federal money into its education spending plans.

The court, in a written ruling handed down in Columbia, South Carolina, said the state legislature had sole authority in South Carolina for appropriating government funds,

While we recognize and respect Governor Sanford's sincerely held beliefs ..., those convictions do not alter the ministerial nature of the legal duty now before him, the justices said.

Sanford has said he would abide by the court's ruling.

Sanford had argued that Obama's stimulus spending was fiscally irresponsible, and he initially refused to apply for $700 million allocated to the state.

But South Carolina's Republican-controlled legislature disagreed and even overrode a Sanford veto of the portion of the state budget using the federal money.

A spokesman for the governor was not immediately available to comment.