BOGOR, Indonesia (Reuters) - Saudi Arabia’s King Salman held talks with Indonesia’s president on Wednesday and signed a range of cooperation agreements at the beginning of a 12-day visit to the world’s largest Muslim-majority country.

Saudi Arabia's King Salman reads documents as Indonesian President Joko Widodo looks on during their meeting at the Presidential Palace in Bogor, West Java, Indonesia March 1, 2017. REUTERS/Adi Weda

The royal visit is the first by a Saudi monarch in nearly five decades.

The leaders oversaw, among 11 pacts, the signing of agreements to take down trade barriers and a new agreement between state energy companies Saudi Aramco and Pertamina, building on an existing $6 billion plan to expand Indonesia’s biggest refinery.

The octogenarian king arrived at a military air base in the capital, Jakarta, earlier on Wednesday and descended slowly from the plane on an escalator before being met by President Joko Widodo who escorted him along a red carpet flanked by guards to a limousine.

King Salman is being accompanied by an entourage that Indonesian officials have said could number up to 1,500. His party is bringing 459 tons of luggage and equipment, including two luxury cars, according to media.

The king was also greeted by Basuki Tjahaja Purnama, Jakarta’s Christian governor, who is on trial for allegedly insulting the Koran. Purnama has denied wrongdoing but his blasphemy trial has inflamed religious tensions.

The kingdom’s ambassador to Indonesia told Reuters on Tuesday the two countries would cooperate in tackling terrorism and that military officers were training in each other’s countries to counter Islamic State militants.

Secular Indonesia has grown increasingly concerned about security, after several attacks over the past year blamed on supporters of Islamic State, and has deployed at least 9,000 police and military for the 12-day visit.

Roads were closed to traffic and snipers stationed along the route the king’s convoy took from the airport to the presidential palace in the town of Bogor.

Slideshow ( 10 images )

Hundreds of children holding Indonesian and Saudi flags welcomed the king.

‘BEST PRACTICES’

King Salman held talks with Widodo as torrential rain lashed the palace grounds.

He will also meet religious leaders, make a speech at parliament, and visit Southeast Asia’s biggest mosque, Istiqlal, on Thursday before a brief trip to Brunei and then an extended break on the Indonesian holiday island of Bali.

Indonesia hopes to attract billions of dollars of investment from the kingdom, though the trip will also focus on building cultural and religious ties and promoting education.

Saudi Arabia aims to open more Islamic schools in Indonesia, which will teach religion using the Arabic language, and step up the number of scholarships for students.

The king’s visit to Indonesia comes as fringe Islamist groups grow in influence and Muslim leaders take an increasingly strict line on Islamic issues, which is at odds with Indonesia’s traditional brand of moderate Islam.

“The two countries face the same challenge of rising radicalism and intolerance so cooperation in those areas will be beneficial,” said Yenny Wahid, a moderate Indonesian Muslim figure and head of the Wahid Foundation.

“Saudi Arabia has been aggressive in de-radicalization and rehab programs for terrorists. We can learn best practices from each other.”

King Salman started his Asia trip in Malaysia and as well as the Brunei stop he will visit Japan, China, the Maldives and then Jordan.