The alleged “systematic” hack of New Zealand’s budget papers turns out to be nothing more sinister than a bit of internet searching.

Earlier this week the opposition National party released pages of the much-hyped “wellbeing” budget, which should have been under strict embargo until 2pm on Thursday.

The treasury secretary, Gabriel Makhlouf, said it appeared the documents had been “hacked”, with over 2,000 attempts to get into Treasury’s IT systems registered in a 48-hour period. Treasury officials said there was sufficient evidence that its systems had been “deliberately and systematically hacked”. The police were informed and an investigation was launched.

In an embarrassing twist for the Labour coalition government, police on Thursday said the documents were sourced legally using the search function on Treasury’s website, and the investigation had been closed.

“The police have advised the Treasury that, on the available information, an unknown person or persons appear to have exploited a feature in the website search tool but that this does not appear to be unlawful,” Treasury said in a statement.

The opposition National party leader, Simon Bridges, called for the resignation of finance minister, Grant Robertson, and treasury secretary, Gabriel Makhlouf, who remained of the opinion that the search attempts – despite being fully legal – were “deliberate, exhaustive and sustained attempts to gain unauthorised access to embargoed data.”

In a news conference, Bridges showed reporters how easy it was to gain access to the documents using the Treasury’s own search tool.

The controversy has drawn attention away from New Zealand’s first budget to put the welfare and wellbeing of its citizens at the forefront of every spending decision.

“What we’ve seen this week is unprecedented and the most contemptible behaviour I’ve seen by a government,” said Bridges.

Adding insult to injury, on Thursday morning in the hours before the budget’s embargo lifted, Treasury staff mistakenly handed out copies of the restricted documents to journalists. Newshub’s political editor, Tova O’Brien, tweeted that budget documents had been distributed, breaching the embargo.

Treasury just started handing out Budget docs before the Budget lock up began - nearly breached security AGAIN — Tova O'Brien (@TovaOBrien) May 29, 2019

Official taking back the early Budget they accidentally handed me early before the “lockup” (thinking I was a Treasury official): pic.twitter.com/z58SShKrK6 — Bryce Edwards (@bryce_edwards) May 29, 2019

Newshub reported that when recipients of the document were asked if they were allowed to be in possession of them before the lockup, a Treasury official asked, “Are you not Treasury?”, before hurriedly taking the copies back.

The finance minister issued a brief statement saying his focus remained on delivering the budget and improving the lives of New Zealanders.

Budget Day tradition- cheese rolls, this time from Dunedin itself, specifically Starfish cafe. Really looking forward to delivering the #WellbeingBudget from 2pm pic.twitter.com/ycKDbk8FPI — Grant Robertson (@grantrobertson1) May 29, 2019

“I’m very disappointed that confidential budget information was able to be accessed in this way,” Robertson said in a brief statement.

“I am also very disappointed that the Treasury did not seek to find more information as to how this happened before referring the matter to the Police.”