Amsterdam will be the new home of the European Medicines Agency and Paris will host the European Banking Authority after down-to-the-wire votes Monday that were settled by drawing names from a bowl.

The decisions mark the end of jockeying and speculation that started shortly after the Brexit referendum in June 2016.

The decision on the European Medicines Agency was made first, on Monday afternoon. EU ministers granted Milan and Amsterdam 13 votes each in the final round of voting, leaving the Estonian presidency of the Council of the EU to oversee the final selection.

It was a snub for countries in Central and Eastern Europe that have long advocated they should get the EMA because they don't already host an EU agency.

Bratislava was seen as one of the favorites before Monday's vote, but did not make it past the first round of voting. Slovakia was the only country to abstain from voting in the second and third rounds, Health Minister Tomáš Drucker confirmed. Milan, Amsterdam and Copenhagen made it into the second round of voting, and Milan and Amsterdam advanced to the third.

In all 19 EU countries initially applied to host the agency, though Malta, Croatia and Ireland withdrew shortly before the vote.

Slovakia's abstention led to the tie between Milan and Amsterdam in the third round.

Shortly after the EMA vote, ministers turned their attention to the EBA — and the result was also tied.

The voting was tight, with Frankfurt and Dublin joining Paris in the second round, before Frankfurt was knocked out, leaving France and Ireland locking horns. The final round saw a draw at 13-13, with Paris drawn out of the bowl.

Frankfurt was the original favorite to host the banking agency, but insiders told POLITICO that Paris had revved up its push to win the EBA in recent weeks.

Paris will be overjoyed at the result, which will aid its wish to become the new financial center of the EU with Brexit forcing London out of the bloc.

In a statement, the EBA welcomed the result: "This is an important decision for the Authority that guarantees a seamless continuation of its activities by reassuring its current and future staff over the new location and putting an end to a period of uncertainty. The EBA is confident that France will support the Authority to ensure a smooth transition."

Drugs regulator's big move

The EMA is one of the most coveted spoils of Brexit, thanks to its nearly 900 well-paid employees, its role at the heart of the EU drug approval system and the massive research and development industry it feeds. The agency also drives business tourism, with more than 30,000 experts flying in for EMA meetings every year.

Now all eyes will be on Amsterdam, which holds the key to whether the EU's drug safety agency can move smoothly from London to the Continent without disrupting its work.

Amsterdam's choice is likely good news for EMA employees, which in a staff survey earlier this year put the city at the top of the list of places they would follow the agency to. More than 80 percent of employees said they would go to Amsterdam if the agency moves there. And EMA's LGBT employees can also breathe easily following their vocal concerns, since the Netherlands recognizes same-sex marriages.

Amsterdam is still working on its building that would rise in Zuidas, the city’s business district, to host the EMA. The building will be custom-built for EMA’s needs, a similar deal to that which the agency had in London’s Canary Wharf, the Dutch government said earlier this year.

The EMA will pay the market price for rent once it moves in, former Dutch Health Minister Edith Schippers said this summer when presenting Amsterdam's bid in Brussels. The building should be ready by April 2019, but it’s possible that EMA staff would need a temporary location for a short period of time before they move to the new building, Kajsa Ollongren, the deputy mayor of Amsterdam, said at the time.

Pharma and patient groups have called for a seamless transition to ensure that the agency's work in approving drugs across the EU is not affected. They welcomed the announcement that the agency would relocate to Amsterdam.

The EMA itself earlier this month called for a joint governance structure to be set up with the successful country and promised “full visibility” of the relocation effort, including a “monitoring chart” to track progress.

Sarah Wheaton contributed reporting.