The details of how mysterious intruders raided North Korea’s embassy in Madrid last month, tricked the Spanish police and made off with a stash of stolen intelligence which they offered to the FBI have been laid out by a Spanish judge.

Spanish police were called to the embassy in the middle of the raid, but were warded off by the Mexican citizen Adrian Hong Chang who pretended to be a diplomat, the Spanish newspaper El País reported.

Donning a traditional jacket, he answered the gate and persuaded officers he was a senior North Korean diplomat, and everything was normal inside the suburban compound. Hours later, he was on his way to Lisbon, where he caught a plane to New York and five days later sought out American intelligence services.

The Spanish interior ministry had previously said the police were investigating an incident at the embassy, but gave no details except to say a North Korean citizen had been injured and no one had filed a complaint.

The 14-page summary from the high court judge José de la Mata described in detail the days of preparations for the raid, carried out by a 10-strong gang armed with knives and fake guns.

During the attack, the attackers identified themselves as members of a secretive human rights group which hoped to overthrow North Korea’s hereditary dictatorship, his summary said. The Washington Post recently named the group as Cheollima Civil Defense.

The raid happened shortly before Donald Trump’s Hanoi summit with the North Korean leader, Kim Jongun, leading to speculation US security forces had played a role, although this was later dismissed by experts.

“Infiltrating a North Korean embassy days before the nuclear summit would throw that all into jeopardy,” Sue Mi Terry, a former Korea analyst at the CIA told the Washington Post. “This is not something the CIA would undertake.”

Seven of the gang have been identified by Spanish authorities. In addition to Hong Chang, they include US and South Korean citizens.

The group reportedly arrived in the Spanish capital in the days before the raid. Once there, Hong Chang stocked up on combat equipment, El País reported, buying four knives, six replica guns, fast-draw gun holsters, protective eye-glasses, torches and a variety of fetters and handcuffs, according to the court.

Others assembled a haul of equipment from hardware shops, including shears, crowbars, 33 rolls of duct tape, pliers, and a ladder, said the court document.

At just past 4.30pm on 22 February, they arrived at the embassy and Hong Chang asked to see the diplomat in charge of commercial affairs, whom he had previously met while posing as a businessman.

When the door was opened, the group forced their way into the compound armed with knives and machetes, crowbars and replica guns, and proceeded to beat and tie up the diplomats. When they were all shackled, they dragged the head of business affairs to a basement where they pressured him to defect, without success.

A woman managed to escape by jumping from the first floor, injuring herself in the process. A passerby who saw her called emergency services, prompting the police to surround the embassy, until they were persuaded to leave by Hong Chang’s imitation of a senior diplomat.

The group stayed for nearly five hours, raking through the embassy and questioning the diplomats, before making off with a haul of equipment, including a set of flash drives, two computers, two hard drives with security images and a mobile phone.

Most of the group left in two embassy cars around 9.30pm, with Hong Chang and three others following soon after through a different exit. The gang then divided into four groups and headed to Lisbon, where they caught planes to New York, the judge said.