After months of pressure by lawmakers and legal challenges by The Salt Lake Tribune, Attorney General Sean Reyes on Tuesday released a secret opinion saying Gov. Gary Herbert acted legally last year as he conducted a special election in the 3rd Congressional District.

The governor had the legal authority to conduct the election as he did, Reyes office concluded, but only because the Legislature had not passed more specific laws outlining procedures.

Of course, the Legislature asked Herbert to call a special session so it could enact such rules — which Herbert refused to do. He noted several legislators were then talking about running for the seat of retiring Rep. Jason Chaffetz, and he worried openly that new rules could be designed to benefit them.

Legislative leaders had requested the opinion from Reyes’ office last year as they weighed potential legal challenges to Herbert early on.

It was completed — but Herbert blocked its release by claiming the governor was the client of the attorney general, who had already been giving him advise on the election. Herbert said releasing an opinion, from a separate part of Reyes’ office, could violate his attorney-client privilege and hurt him in a possible lawsuit with the Legislature.

The governor insisted he had never seen the contents of that secret opinion, which it turns out supported his position.

Legislators fumed and blasted Herbert and Reyes for withholding that opinion. The Salt Lake Tribune sought the document through an open-records request. The Utah Records Committee eventually ruled unanimously that the public interest in the document outweighed the privacy interest, and ordered the opinion released to the newspaper. But Reyes then challenged that in 3rd District Court, arguing that the Records Committee order was tainted because it was signed by Holly Richardson, who also writes columns for The Tribune.

On Tuesday, Reyes released a letter sent to him last week by Herbert, House Speaker Greg Hughes and Senate President Wayne Niederhauser. They jointly agreed that since the election won by new Rep. John Curtis was over, differences about the procedure “that resulted in his election are moot” — showing Herbert no longer need fear legal action from the Legislature.

They encouraged Reyes to release the opinion because it “may be of use to the legislative process as lawmakers contemplate the process for elections to fill congressional vacancies.” Rep Jeremy Peterson, R-Ogden, has opened a bill file to rewrite the rules for special elections.

Tuesday, Reyes did release the long-secret opinion, summarizing in an accompanying letter that “Herbert’s actions appear to have been within his statutory and constitutional authority.”

So why didn’t Reyes and Herbert decide to release that much sooner?

“At its core was our ability to effectively represent the executive branch, and not be compelled to potentially harm a client,” Reyes wrote.

“Inappropriately providing analysis that could be used by a possible opponent [the Legislature], especially over the objection of our client, would damage our ability to defend them. It would also potentially violate our oath and ethical obligation to adhere of the Rules of Professional conduct,” Reyes wrote.

The Utah Constitution says that the attorney general is the legal adviser to the executive branch, but a state law says that the AG “shall” provide written legal opinions requested by the Legislature.

Reyes said “our office had no clear ethical path forward. In that environment, I was not willing to ask my attorneys to step into the breach. I was also unwilling to potentially harm a client to whom I have legal, ethical and constitutional responsibilities.”

Reyes said now that the threat of lawsuits “is behind us and our client has waived the conflict of interest,” barriers blocking release of the document “have been removed.”

Hughes and Niederhauser released a statement Tuesday thanking Herbert and Reyes for releasing the opinion, and said it will help its work in the upcoming legislative session to write permanent rules to govern future special sessions. “Of course, we would have liked it earlier,” Niederhauser said in an interview.

The opinion outlines details behind the conclusion that Herbert acted legally.

It agreed with assertions by legislative leaders that it usually is their prerogative “to promulgate regulations for congressional elections, including elections to fill vacancies.”

However, it said the Legislature had never written such rules into law — even though they asked Herbert to call them into a special session to do that.

The opinion said that because the Legislature “has not prescribed the time for or manner of holding the election, it ‘leaves room for executive discretion’” — allowing the governor to set rules for the election legally.

Also, legislative leaders had asked for an opinion about when a vacancy actually occurs — because Chaffetz announced he would resign weeks before he actually did, and Herbert issued a proclamation outlining and starting election procedures before Chaffetz actually left.

The opinion said a vacancy occurs only when someone actually leaves office, “but nothing in Utah law prohibits — and national practice supports — the potential for a pre-vacancy procedure to fill a soon-to-be vacant congressional seat.”