The same open-border policies that allow people and goods to flow freely across Europe also make it extremely difficult to crack down on illegal weapons. (Oliver Bunic/Bloomberg)

Europe, a continent long known for the rarity of gun violence, is confronting twin challenges that give the issue sudden urgency: a growing population of radicalized young men determined to strike targets close to home, and a black market awash in high-powered weapons.

The problem has been rendered vividly in recent weeks by a pair of deadly assaults that each paralyzed a European capital. In Paris and Copenhagen, the attacks were carried out by former small-time criminals turned violent extremists who obtained military-grade illicit weapons with apparent ease.

[5 countries where police officers do not carry firearms — and it works well]

In contrast with the free-firing United States, Europe is generally seen as a haven from serious gun violence. Here in Denmark, handguns and semiautomatic rifles are all but banned. Hunting rifles are legally available only to those with squeaky-clean backgrounds who have passed a rigorous exam covering everything from gun safety to the mating habits of Denmark’s wildlife.

“There’s a book about 1,000 pages thick,” said Tonni Rigby, one of only two licensed firearms dealers in Copenhagen. “You have to know all of it.”

But if you want an illicit assault rifle, such as the one used by a 22-year-old to rake a Copenhagen cafe with 28 bullets on Saturday, all it takes are a few connections and some cash.

“It’s very easy to get such a weapon,” said Hans Jorgen Bonnichsen, a former operations director for the Danish security service PET. “It’s not only a problem for Denmark. It’s a problem for all of Europe.”

European leaders have made tighter controls on weapons trafficking a priority in recent weeks, following the killing of 17 people in Paris by three attackers. The shootings in Copenhagen this past weekend, which left two people dead, raised the ominous prospect of copycat attacks across Europe.

But officials acknowledge there is no clear solution. The same open-border policies that allow people and goods to flow freely across the continent also make it extremely difficult to crack down on illegal weapons — a fact that arms dealers have been all too eager to exploit.

“You can find Kalashnikovs for sale near the train station in Brussels,” acknowledged a Brussels-based European Union official who spoke on the condition of anonymity because he was not authorized to speak on the record. “They’re available even to very average criminals.”

In the case of the Paris attackers, they were able to obtain an entire arsenal: AK-47 assault rifles, pistols, a Skorpion submachine gun and even a rocket-propelled-grenade launcher. All of it was purchased in Brussels for about $5,000, according to Belgian media reports.

The availability of such weapons in the heart of Western Europe isn’t new. The flood of high-powered weaponry began with the dissolution of the Soviet Union and continued through the 1990s as war raged across the Balkans. Many of the weapons from those periods are still circulating. They have lately been supplemented by an influx from the turmoil in North Africa, with weapons smuggled on ships across the Mediterranean.

The guns have been used primarily by criminal gangs that turn them on one another during periodic turf wars.

But beginning with attacks in the French city of Toulouse in 2012 that left seven people dead, guns have also become the weapon of choice for Islamist terrorists in Europe.

That’s a shift from the last decade, when bombs were used in mass-casualty attacks on transit systems in London and Madrid.

The new tactics may reflect the lone-wolf nature of the recent assailants, who seem to have operated with relative autonomy and not as part of centrally directed terrorist plots.

Analysts say explosives can be easier to detect than guns and are harder to transport and assemble. Guns also require less expertise, allowing even petty gangsters such as Omar Abdel Hamid el-Hussein, the assailant in Copenhagen, to carry out deadly strikes.

The use of guns has enabled terrorists to pick their victims more precisely. In Paris and Copenhagen, the targets were the same: cartoonists, police officers and Jews.

Guns have also been the weapon of choice in other recent lone-wolf attacks carried out in Ottawa and Sydney, suggesting the problem is hardly limited to Europe.

But it is a particularly challenging issue for Europe because of the continent’s open borders. With 28 countries in the European Union, each with its own rules and regulations, controlling the flow of weapons has been nearly impossible.

“A firearm that is illegal in one country may be legal in another,” said Raffaello Pantucci, director of international security studies at the London-based Royal United Services Institute. “You have continuous land all the way through to Russia and into the Balkans, which of course until a few decades ago was a war zone.”

Even assessing the scale of the problem has proven too difficult for Europe. A comprehensive European Commission study released last year cited an estimate of 67 million illicit firearms across the continent. But it also noted that the total was probably overstated and concluded that “no accurate quantification of the problem is feasible.”

U.S. law enforcement has long maintained an extensive database of lost and stolen weapons. But Europe has only recently begun to do so, working in concert with Interpol. So far, the database is believed to contain only a small fraction of the total.

One country that has largely succeeded in keeping illicit firearms out is the United Kingdom. Because Britain does not participate in the continent’s open-borders program — and because it is an island with strictly enforced weapons laws — guns are rare. Out of desperation, criminals and would-be terrorists in Britain have occasionally turned to antique weaponry — flintlock pistols and Wild West-style revolvers — as the most deadly options available.

Hussein, who first attacked a cafe and then struck at a synagogue, had a much wider selection to choose from. His primary weapon — an M95 assault rifle that can fire up to 900 rounds a minute — was stolen from the home of a member of the Danish Home Guard in 2013, police say. Hussein probably purchased it illegally, along with two semiautomatic handguns.

Analysts say the M95, which was used by the Danish army from 1995 until 2010, is more uncommon on the black market than other weapons. Kalashnikovs are “fairly easy to get ahold of. It’s the heavier-caliber, larger machine guns that are more difficult,” said Philip Boyce, a firearms expert with Forensic Equity.

But thefts can bring them into circulation. In 2009, more than 200 weapons — including grenade launchers and machine guns — were plundered from a Danish military barracks in what prosecutors later said was an inside job.

Even with the high-profile gun attacks of recent weeks, there’s been no major push in Denmark or elsewhere in Europe to loosen the gun laws. While American firearms advocates preach the necessity of self-defense, the argument holds little sway on a continent where citizens have seldom had to worry about gun violence — and hope the recent killings prove an aberration.

“As I see it,” said Rigby, the Copenhagen gun dealer, “more guns on the streets only means more trouble.”

Adam reported from London. Maren Mosaker in Copenhagen contributed to this report.