Bangkok: The leaders of Thailand and Malaysia agreed on Friday to boost security cooperation and consider building a border wall to combat transnational crime and smuggling, an idea that appears to be gaining popularity elsewhere in the world.

People-trafficking and the smuggling of contraband, including drugs and petrol, have flourished along the Thai-Malay border for years until a crackdown by Thai officials on human traffickers caused some of the routes to shut down last year.

Analysts say separatist insurgents operating in Thailand’s deep south use Malaysia as a base to launch and plan their attacks.

Malaysian Prime Minister Najib Razak told reporters that security remained “a very important matter” for both countries and there was an agreement to step up intelligence gathering and sharing to rein in cross-border terrorism.

“We both face security issues including the fight against terrorism, human trafficking and illegal smuggling, that is why we need to address these issues seriously,” said Thai Prime Minister Prayuth Chan-ocha.

Najib said both sides had discussed the construction and extension of a border wall but details remained to be worked out.

“The matter is under consideration, but we need to determine the physical dimensions of the wall or fence as well as the sharing of the costs,” he said.

The step reflects a controversial plan by US presidential candidate Donald Trump to build a wall on the border between the United States and Mexico, and get Mexico to pay the cost.

It remains unclear who will pay for the Thai-Malaysia wall, which the two countries first formally discussed last year. A fence already runs along parts of their 640-km border.

Najib’s visit follows three deadly bomb attacks in southern Thailand over the past month, including a wave of bombings in tourist towns in August that Thai police linked to Muslim separatists.

Analysts say the attacks were carried out by a separatist insurgent group known as Barisan Revolusi Nasional after it was left out of peace talks between Thailand and another separatist umbrella group in Malaysia.

Thailand’s three southernmost provinces of Pattani, Yala and Narathiwat were part of an independent Malay Muslim sultanate until Thailand annexed them in 1909.

Since 2004, Muslim separatists operating in the area have waged a bloody insurgency that has killed more than 6,500 people, says conflict monitor Deep South Watch.

“It is clear why Thailand is pursuing this wall,” Srisompop Jitpiromsri, a director of Deep South Watch, told Reuters.

“They view it as a necessary step to combat these groups that cause violence.”