As migrants by the thousands pour daily into Hungary, the government is hastily building a barrier along its 174-kilometer (109-mile) border with Serbia: three layers of razor wire and a 4-meter (13-foot) high fence. The migrants, however, are just climbing over the razor wire or crawling under it.

Here's a look at current and historic border barriers, an approach that has been taken for centuries with varying degrees of success.

___

HISTORIC BARRIERS:

___

GERMANY: THE BERLIN WALL

Germany last year celebrated the 25th anniversary of the fall of the Berlin Wall, built in 1961 by communist East Germany. East German leader Walter Ulbricht billed the 155-kilometer (96-mile) barrier as an "anti-fascist protective wall," protecting his citizens from the West, but in reality it was to stop his citizens from fleeing for the West. Despite the formidable obstacle and threat of stiff punishment, many tried to escape by tunneling under it, swimming past it, climbing on it or flying over it. At least 138 people died in the attempt.

The Berlin Wall, however, inadvertently provided the West with a great propaganda tool. U.S. President John F. Kennedy stopped by it when he visited Berlin and U.S. President Ronald Reagan issued a call in 1987 to then-Soviet leader Mikhail Gorbachev to "tear down this wall!"

___

BRITAIN: HADRIAN'S WALL

In the 2nd century A.D., the Roman occupiers of Britain built Hadrian's Wall, a stone barrier up to 20 feet (6-meters) high and dotted with forts, for 73 miles (117 kilometers) across northern England. The wall marked the northwest frontier of the Roman Empire and guarded Roman conquests in Britain from "barbarians" to the north. Historians have long debated its military effectiveness, but it did serve as a symbol of Roman power and a way to control cross-border traffic.

___

CHINA: THE GREAT WALL

In 220 B.C., China joined existing walls and fortifications to defend against invasions from northern "barbarians," marking the beginning of the Great Wall. Construction continued up through the Ming dynasty (1368-1644) until the wall became the world's largest military structure. Fortresses and watch towers were built along it to defend towns, passes or other strategic points and paths along the top of the wall allowed troops and couriers to move quickly. Estimates of its overall length vary, but according to UNESCO, which named the Great Wall a World Heritage Site in 1987, it once ran for more than 20,000 kilometers (12,500 miles).

___

CURRENT BARRIERS:

___

UNITED STATES: THE MEXICAN BORDER

The United States has spent billions of dollars over the last decade fencing a third of its southwest border with Mexico in an attempt to stop the flood of immigrants. Stretching 650 miles (1,046 kilometers), the fence runs through California, Arizona, New Mexico and Texas. In some places it's a 15-foot (4.6-meter) high curtain of corrugated metal, while newer sections feature 20-foot (6.1-meter) high steel columns. Border apprehensions are down considerably, but immigrants still find ways to cross the border. Republican presidential hopeful Donald Trump has made the barrier a campaign issue, saying it is insufficient and that a wall should be built.

___

ISRAEL: WEST BANK BARRIER

Israel has built several walls and fences, including its West Bank separation barrier, which is to reach 450 miles (700 kilometers) when complete. Israel says the stretch of concrete wall, fencing and razor wire aims to keep out Palestinian attackers, while Palestinians say the barrier is a land grab that juts into territory they want for a future state.

Israel says the wall has been effective in reducing violence, but better intelligence, a changed political climate and other security measures may also be responsible. The wall remains incomplete and thousands of Palestinians who do not hold permits to enter Israel still make it in, looking for better-paying jobs.

Israel has a fence along its 130-mile (220-kilometer) border with Egypt to block migrants from strife-torn African countries, as well as fences along its borders with Syria, Lebanon and the Gaza Strip, where it has fought three wars since 2005.

___

BRITAIN: BELFAST'S "PEACE WALLS"

Northern Ireland's capital, Belfast, remains scarred today by scores of walls and other barbed-wire barricades designed to separate Irish Catholic and British Protestant districts. The British Army erected the first crude barriers in 1969 when Belfast suffered its first major Catholic-Protestant clashes in decades. The British territory's broadly successful peace process since the 1990s has done little to reduce the number or size of the walls. Analysts say Belfast's nearly 30 so-called "peace walls" do help keep the peace by making street clashes between rival groups more difficult.

___

SPAIN: CEUTA AND MELILLA

Spain has six-meter (20-foot) twin border fences around their two North African enclaves, Ceuta and Melilla. Both cities back the Mediterranean Sea on one side and are surrounded by Morocco. In recent years, the enclaves, particularly Melilla, have been frequently stormed by hundreds of migrants, mostly from sub-Saharan countries, hoping to get a foot into Europe. Most have been turned back at the fences. Increased cooperation between Spain and Morocco has reduced the number of scaling attempts dramatically in recent months.

___

SOUTH AFRICA: ZIMBABWE

The border between Zimbabwe and South Africa has seen countless crossings in the years since Zimbabwe's economic collapse, with estimates ranging from several hundred thousand to three million Zimbabweans immigrants in South Africa. South African police patrol a barbed-wire boundary sometimes reinforced with a steel metal fence, while Zimbabwean officials have erected a loose barbed wire fence. Still, the border remains porous. People known as "magumaguma" — the Shona language word for tricksters — will "facilitate" a crossing into South Africa for a price.

___

Associated Press Writers Lynsey Chutel in Johannesburg; Pablo Gorondi in Budapest, Hungary; Tia Goldenberg in Jerusalem; Jill Lawless in London; Shawn Pogatchnik in Dublin and Ciaran Giles in Madrid contributed to this report.