The Malaysian prime minister has thanked King Salman for his support during a visit to Saudi Arabia meant to deepen ties between the two major Muslim countries.

Najib Razak's visit comes after Malaysia's attorney general in January decided not to prosecute the prime minister, saying the $681 deposited in his accounts were a "personal donation" from the Saudi royal family.

The chief prosecutor also said most of the Saudi donation had been returned.

Razak's critics, however, accuse him of corruption and claim hundreds of millions of dollars channeled into his accounts came from the indebted 1MDB fund, which he founded in 2009.

Najib met with King Salman on Wednesday and earlier spoke at an economic forum in Saudi Arabia, where he "personally thanked" the Saudi royal family for their support.