BOGOR, Indonesia - 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.

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 blaspheming the Holy Quran. 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. Hundreds of children holding Indonesian and Saudi flags welcomed the king. 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.

"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. Almost 460 tons of equipment have been flown in for the visit, including limousines and escalators.

Preparations have been elaborate. Naked statues at the Bogor palace were covered up before Salman's arrival. Some 150 chefs have reportedly been hired to cook for the king's party and a VIP toilet has been constructed at a mosque he will visit.

Widodo hailed the "historic" visit, adding: "As the country with the biggest Muslim population in the world, Indonesia will always have a special bond with Saudi Arabia."

The leaders oversaw the signing of 11 cooperation memoranda following Wednesday's talks at the Bogor palace. Apart from trade and aviation, they included agreements on boosting cooperation in science, health and fighting crime.

Jakarta and Riyadh also inked an agreement that builds on an existing $6 billion deal between state-owned energy firms Aramco and Pertamina to expand an Indonesian oil refinery.

Salman, 81, said he hoped the visit would "contribute to the improvement of the bilateral relationship between our two countries".