Former Gov. Deval Patrick’s administration secretly diverted nearly $27 million in public money to off-budget accounts that paid for a $1.35 million trade junket tab, bloated advertising contracts, and a deal with a federally subsidized tourism venture backed by U.S. Sen. Harry Reid, a Herald investigation has found.

The maneuver to fatten the hidden “trust” ??accounts with millions from state quasi-public agencies allowed Patrick to skirt the state Legislature and evade state budget cutbacks during the recession, the Herald found.

State lawmakers never approved the funding plan, and it’s not clear who even knew about it, but it is clear who orchestrated the end-around the budget and got state agencies to contribute.

“The (Patrick) administration asked us to,” said Katie Hauser, spokeswoman for the Massachusetts Convention Center Authority, which kicked in the largest amount to the trusts, $23.5 million.

One of the trusts was run by a close Patrick loyalist, Betsy Wall, a former top campaign aide later appointed as the $134,000 head of travel and tourism.

The trust dinging taxpayers for Patrick’s around-the-world travel was funded by Massport and the Mass Tech Collaborative, an obscure agency that gets state and federal dollars, including an injection of Obama stimulus money.

Those two agencies, along with the MCCA, funneled nearly ?$27 million to the trust plan.

Records show that from 2011 to 2014, Patrick and his traveling entourage rang up a $535,558 hotel tab, $332,193 in airfare, $305,976 for limos and transportation and $175,000 in other costs. All told, it came to $1.35 million.

The total cost of Patrick’s overseas trips, including a $225,000 visit to China in 2007 — before the trust accounts were created — cost $1,573,949, according to records from the state’s Housing and Economic Development office, which oversaw the accounts. The 10 overseas junkets, including a $364,000 trip to South America, cost far more than the Patrick administration previously disclosed.

Patrick started a nonprofit designed to pay for the trade missions in 2010, but after spending only $130,000 in private donations, the effort apparently was scuttled. Records at the attorney general’s office show no spending or donations to the nonprofit after 2011.

In an email response, Wall said she had no conversations with Patrick on using the trusts to fund trade missions.

The donations from the convention center authority under its then-Executive Director James E. Rooney could raise eyebrows. Patrick approved the MCCA’s expansion plans in 2014 after the authority had given the $23.5 million to the tourism trust. Gov. Charlie Baker has since halted the expansion.

That trust run by Wall funneled more than $17 million to the state tourism office’s advertising firm, Connelly Partners, in addition to the millions Connelly got through budget appropriations, records show. Wall’s trust also provided $223,000 in extra funding to the Boston Symphony Orchestra and $500,000 to Brand USA, a Washington-based public-private partnership launched by Congress and strongly backed by Reid, records show.

Brand USA has been criticized for being a haven for Democratic cronies and a benefit for Las Vegas casinos in Reid’s home state.

In an email response, Wall said the tourism trust was designed to “ease the pressure on the state budget” but declined to say whether legislative leaders were aware of the spending.

Other trusts, funded mostly by the quasi-public agency Mass­Development, got more than ?$10 million to help fund operations and other ventures for the Housing and Economic Development and Business Development offices.

All told, contributions from the quasi-public agencies to the trusts totaled $37.35 million.