Around 1500 lawmakers, government employees and international bankers stuck inside Bosnia's parliament for 14 hours were allowed to leave the building in the early hours of Friday after a deal was reached with blockading protesters outside.
Thousands of people, most of them students and young parents with babies, surrounded the building on Thursday to protest at the failure of Bosnia's rival Serb, Croat and Muslim lawmakers to agree on how to determine the 13-digit identification numbers assigned to every citizen.
Bosnia's international peace envoy Valentin Inzko convinced the protesters to let the trapped people out at 0400 am by promising to help resolve the issue.
Some 250 foreign bankers who were attending a finance conference were among those caught up in the blockade and some had appealed to their embassies to help them get out of a "hostage situation", Inzko said.
"I received calls from Austrian and German diplomats asking to help them get out," Inzko told state television on Friday.
"This will reflect on Bosnia's image abroad because these people are foreign bankers who came to inquire investment possibilities in Bosnia."
The row over how to draw up districts for ID numbers is one of the most egregious examples of the ethnic politicking that has plagued Bosnia since the end of its 1992-95 war, which left the country with a weak central government and a system of ethnic quotas that has stifled development.
In early February, a court ruling effectively froze registrations, meaning newborns cannot be issued with passports or the medical cards they need to be seen by a doctor.
The protest outside parliament was organised after the parents of a three-month-old baby revealed on Facebook this week that their child was denied travel documents for an urgent stem-cell transplant in Germany.
On Wednesday, the government reached an interim deal to resume issuing identification numbers for the next six months, including for the baby, until a long-term agreement is reached.
The protesters said they will continue their demonstrations as long as it takes, however.
The government of Bosnia's autonomous Serb Republic, which makes up Bosnia along with a federation dominated by Muslims and Croats, has called a session of its parliament on Friday to discuss the situation.
Bosnian Serbs are pressing for a new registration arrangement along territorial lines. Muslims, known as Bosniaks, say that would only cement the ethnic divide.
"Unfortunately, this is a real picture of Bosnia's reality and illustrates the political crisis and impotence of the system," opposition deputy Asim Sarajlic told state television after leaving the parliament.