LOS ANGELES (Reuters) – A Marine veteran accused of taking part in a raid on the North Korean Embassy in Madrid was ordered freed on $1.3 million bail on Tuesday but must serve home confinement ahead of his possible extradition to Spain.

U.S. Magistrate Judge Jean Rosenbluth, at a hearing in Los Angeles, warned Christopher Ahn, 38, that family members or close friends who posted bail for him could lose their money or property and face contempt of court charges if he fled.

“I spent a lot of time reading about you and I'm confident you're going to do the right thing,” Rosenbluth told Ahn, who had several family members in attendance at the hearing.

The judge told Ahn, who lives in Chino Hills east of Los Angeles, he was to wear an ankle monitor and remain at home except for medical appointments and church.

Spanish authorities have charged Ahn with being among at least six individuals who entered the North Korean mission on Feb. 22 in Madrid, beat some embassy personnel, held them hostage for hours and then fled.

The intruders removed computers, computer drives and a mobile phone from the embassy, according to U.S. court documents.

The charges Ahn faces in Spain include breaking and entering, robbery with violence and causing injuries, according to U.S. court documents.

At least two of the individuals charged in Spain remain at large, including Adrian Hong, a Mexican national and longtime U.S. resident and activist who is said to have led the group.

Spanish investigators identified the intruders as members of a group called Cheollima Civil Defense, or Free Joseon, that seeks the overthrow of North Korean leader Kim Jong Un.

'Underground railroad'

An attorney for Ahn has acknowledged he was part of an “underground railroad” that helped at least one person and his family flee North Korean authorities, according to U.S. court documents.

The term underground railroad most commonly refers to a network of secret routes and safe houses that African-American slaves used to seek freedom in the 19th century.

Rosenbluth mentioned concerns about an “underground railroad” at the hearing on Tuesday, as she crafted conditions of Ahn's release – such as not contacting Hong – which she said were intended to keep him from fleeing.

Ahn was expected to be released from custody in the coming days after bail is posted, said Ciaran McEvoy, a spokesman for the U.S. Attorney's Office.

Ahn, who joined the U.S. Marines at 24 and served for six years, was not in the military at the time of the incident at the embassy.

“It's like a huge weight has been lifted off of our shoulders knowing that he's going to be home, he's going to be with loved ones, we can visit with him now,” Juan Sanabria, 35, a former Marine who served with Ahn in Iraq said outside court.

U.S. agents arrested Ahn on April 18 in Los Angeles, and his attorneys have sought his release from custody since then.

Prosecutors objected to Ahn's release, saying he is a flight risk.

SEE ALSO: Former US Marine Arrested In Connection To Raid On North Korean Embassy In Spain

WATCH NEXT: President Donald Trump And Kim Jong Un Shake Hands