AUGUSTA — Republican Gov. Paul LePage’s former chief legal counsel, who’s now a state judge, gave advice that led to 65 bills becoming law over the governor’s objections.

Documents released by LePage’s office after a Freedom of Access Act request by The Associated Press reveal his administration had been preparing to veto a slew of bills by their July 2015 deadlines until late June 2015, when staffers appeared to change course following legal advice from then-chief legal counsel Cynthia Montgomery.

LePage argued that Maine’s constitution prevented him from returning bills to the Legislature when it adjourned June 30, 2015. He unsuccessfully tried to veto the bills when legislators returned July 16, 2015.

The unusual interpretation led to a potential constitutional crisis, with the governor and lawmakers at odds over whether bills had become law. Among the bills were proposals to extend welfare benefits to asylum seekers, expand access to an antidote to drug overdoses and provide birth control for MaineCare recipients.

On June 29, 2015, LePage’s then-senior policy adviser, Avery Day, emailed questions to Montgomery about the adjournment’s potential impact on veto deadlines.

Montgomery cited a 1981 Maine Supreme Judicial Court opinion indicating LePage had more time for the vetoes, mirroring the strategy LePage later used in court.

Montgomery wrote that, hypothetically, if the Legislature passed bills on June 30, 2015, LePage could use his line item veto power on July 1, 2015, and return the bills. Then on July 16, 2015, the Legislature could override the line item vetoes, return the bills to the governor and adjourn, she wrote.

“When they return and are in session for three days, the governor has until the end of the third day to veto the bill,” Montgomery wrote.

Montgomery came to a similar conclusion in her July 2015 analysis of LePage’s reading of Maine’s constitution.

The Supreme Judicial Court, which LePage asked to weigh in, eventually concluded that the governor had goofed.

Montgomery couldn’t be reached for comment by telephone Wednesday, and a courts spokeswoman didn’t immediately respond to a request for comment.

During Montgomery’s confirmation hearing in January, LePage said his opponents shouldn’t blame Montgomery for legal strategies he directed.

At the hearing, LePage called Montgomery a fine attorney and defended her in the veto debacle, saying it was his mistake. The Judiciary Committee unanimously recommended her, with one legislator noting that lawyers argue in court on behalf of their clients.

The records showed that a week after then-legislative coordinator Lance Libby assigned aides to write veto messages for bills by specific due dates, Libby emailed them July 2, 2015, saying the governor wouldn’t send vetoes until January 2016. Libby added that it seemed like LePage could still veto bills “now.”

LePage’s office didn’t respond to requests for comment Wednesday. But spokeswoman Adrienne Bennett told TV station WMTW that staff prepared to react to all scenarios and ultimately decided LePage didn’t need to act by July 3, 2015.