Shortly after his patron Giuliano died in 1516, Leonardo left Italy forever to live and work in France. King Francis I of France appointed Leonardo to the position of "First painter, architect and mechanic of the King" and gave Leonardo a comfortable house near the King's own residence in Amboise where he visited Leonardo often for conversation. The King paid Leonardo well and allowed him to pursue his own interests in engineering and architecture.
During these last years of his life Leonardo began to arrange and edit his scientific papers, a task left unfinished at his death. Leonardo died in his home in France on May 2, 1519. His notebooks and paintings passed into the possession of his favorite student and long-time friend Francesco de Melzi, who had traveled to France with Leonardo in 1516.
Interestingly, while we know that Leonardo was buried in the palace church, we no longer know where his grave is located. The church and palace were destroyed during the French Revolution, and the grave can no longer be found.