By Craig Jarvis and Lynn Bonner

The head of the state's courts system announced Monday he is stepping down at a time when he faces increasing conflict from Republican legislators for directing magistrates to conduct same-sex marriages, and after struggling through several years of budget cuts.

John W. Smith will retire as director of the N.C. Administrative Office of the Courts effective May 1, according to a news release from the agency.

He has been a state judge and a prosecutor, and worked in the court system for more than 40 years. He was appointed director of the AOC in 2009.

Smith and Senate leader Phil Berger had an extended disagreement over magistrates officiating at same-sex marriage ceremonies. Berger was sharply critical of Smith's instruction that magistrates could not opt out of performing such ceremonies. Since October, several magistrates have resigned rather than perform gay marriages.

In a Nov. 2 letter, Berger said Smith was not making "any sort of reasonable effort to constructively guide courthouse officials at a time when such leadership is needed most."

A bill allowing magistrates to refuse to perform all marriage ceremonies based on religious convictions has passed the Senate. During debate, Republican senators jabbed the AOC for not finding a way on its own to accommodate magistrates who did not want to participate in gay weddings. The announcement of Smith's retirement comes at a time when the court system is making a big push for increased state funding.

"Judge Smith has navigated our courts through some of the most challenging economic times in our state's history," N.C. Supreme Court Chief Justice Mark Martin said in the statement. "We can all be grateful for his steady leadership, dedicated service, and commitment to the administration of justice in North Carolina."

"It has been an honor to serve the North Carolina Judicial Branch and Administrative Office of the Courts," Smith said in the statement. "We have one of the finest court systems in the country, and I am humbled to have been a part of it."

(c)2015 The News & Observer