According to Giorgio Vasari in his Lives of the Artists, Leonardo da Vinci once explained away his tardiness in completing a commission by arguing that "men of lofty genius sometimes accomplish the most when they work the least". He was as good as his dictum, painting a mere 20 or so works of which only 14 that are unequivocally his survive. Nine of these will be appearing in the National Gallery's new exhibitionLe. The last time such a number of his pictures appeared together was in Milan in 1939. This, then, is a once in a lifetime show.

What does it take to make such an extraordinary event happen? How did the gallery manage to prise some of the most precious works in art off the walls of the Louvre and the Vatican and get them to London?

The idea came five years ago when the National's then director, Charles Saumarez Smith, asked Luke Syson, the gallery's curator of early Italian art, for an idea for an exhibition. At that point the National's own Leonardo, The Virgin of the Rocks, was being restored and was uppermost in Syson's mind. He proposed an exhibition focusing on Leonardo's most productive period, the 16 years he spent in Milan working for the city's grandee Ludovico "Il Moro" Sforza from 1482/3 to 1499. The National's brief is that there should be a scholarly armature underpinning all of its exhibitions and, where possible, that their own paintings should be central to them. So the questions the gallery's exhibition committee put to Syson were not only "What are the aims of the show?" and "What is the National's position on Leonardo?" but the even more pertinent "What is the likelihood of getting loans?" Syson's first call was to Martin Clayton at Windsor Castle. The Queen owns the world's greatest collection of Leonardo drawings (some 600 of them) and Clayton is their keeper. From that telephone conversation onwards he was a big supporter of the exhibition and indicated from the outset that the Royal Collection would be an enthusiastic lender.

This informal approach is the way most exhibitions come about. It is not gallery directors exchanging letters or government ministers bearding their peers but curators who know other curators and who ring them up as friends. Indeed the smallness of the art world in its upper echelons is such that, for example, both Syson and Larry Keith, the National Gallery's director of conservation, are members of the Louvre's committee overseeing the restoration of one of its post-Milan Leonardos, the Virgin and Child with St Anne. Such connections help.

As Syson and his French equivalent Pierre Delieuvin started talking they quickly found common ground. "If you don't ask, you don't get," says Syson, and so, sitting on a bench in the Louvre's Grand Galerie, he asked if there was any possibility of borrowing the Louvre's version of The Virgin of the Rocks and La Belle Ferronnière, the portrait that is unreasonably overshadowed by the Mona Lisa. The answer was yes and with a bit of genial but thoroughbred horse-trading they thrashed out that the National would in return send its Leonardo cartoon of The Virgin and Child with St Anne to France to show alongside the painting that resulted from it. This gentleman's agreement had to be ratified by both sets of trustees but, says Syson, such swaps are not a quid pro quo but are "natural and organic" between institutions with friendly relations and shared scholarly aims. "It is synchronicity, some things just emerge."

The same was true with the Vatican and the National secured the loan of its unfinished St Jerome. With it Syson now had an exhibition but his aim was to get all of Leonardo's Milan paintings and other key pictures needed more effort. The National's dealings with some galleries are not as regular as with the Louvre and the Vatican and so he approached the Czartoryski Foundation in Cracow, the Hermitage in St Petersburg and the Ambrosiana in Milan with the aim of "instigating conversations to establish if they'd be happy to entertain a longer conversation".

The indications were favourable so the National's new director, Nicholas Penny, travelled with Syson to make formal representations. In presenting the gallery's case they laid out the pros and cons of loaning, discussed whether the paintings were fit to travel, talked about the aims of the exhibition, pointed out that several central works were already promised and, above all, made it clear, as Syson says, that they knew it was "a big ask". In the end the National agreed to lend works to both the Hermitage and the Ambrosiana. It took a year but they got their agreement.

When the other loans followed – the Duke of Buccleuch's Madonna of the Yarnwinder and the newly attributed Christ as Salvator Mundi from a private collection (apparently owned by a consortium) – Syson had a full hand of Leonardo's Milanese pictures.

Discussion then returned to the National Gallery. It was decided the exhibition should be shown in the Sainsbury wing where the scale of the rooms suited the size of the paintings and which, lacking natural light, are ideal for the display of drawings. It was also decided to restrict visitor numbers, albeit losing revenue, so as not to make the exhibition experience an equivalent, says Syson, of "the Black Hole of Calcutta".

The decision to devote each room to an individual Leonardo and surround it with supporting drawings and works by followers was Syson's. Then came the choice of which direction the visitors' route should take. The hanging scheme was worked out by Syson three years ago, using a scale model of the rooms and miniature reproductions of each painting stuck on with Blu-Tack.

In the background the National's registrars, its bureaucrats, were establishing a paper trail of permissions and correspondence for each loan, collating details of the frames, the nature of its fixings, what the ambient temperature surrounding each picture should be and how they would be transported.

Having decided which painting would hang where, Syson still had other decisions to make. Time was put aside with the gallery's education department and a labeller to discuss the exhibition's captioning. It is an important topic, since some studies have shown that gallery visitors can spend more time reading the labelling than looking at the pictures themselves. What was the message each picture should get across? What was the background information that should greet the visitor in each room? What should be the content of the audio guide and introductory film?

The colour of the background walls was still undecided and is usually a late decision: "You really need the pictures there to choose," Syson says. The scheme he has in mind uses tones from the paintings – greys, blacks and purples – and also Leonardo's own suggestion that a blackened courtyard with gauze blotting out the sky was the best way to show off the human face.

Alongside the physical appearance of the exhibition the curator also has to organise the catalogue. Catalogues are a key part of the National's brief since they are a showcase for the current state of scholarship and also a place where matters that are not covered in the exhibition can be discussed. They remain works of reference long after the exhibition has closed.

Other commercial decisions taken by Syson, Penny and the gallery's press and marketing departments include choosing the exhibition poster – in this case the cropped face of the Polish portrait of Cecilia Gallerani (The Lady with an Ermine) - and the sort of merchandise to be offered in the National's shop. The postcards, says Syson, "can't just be pretty women".

The National's exhibitions traditionally last three months (which is also the maximum time drawings can be safely displayed) and the slot is decided by the gallery's existing programme and the availability of loans. Time begins to concertina when the paintings arrive. For reasons of security galleries are cagey about how the pictures are transported. What is likely is that lending institutions will wrap their paintings – still in their frames – in either silk or Japanese paper so that nothing plastic or abrasive can touch the surface, and that they put them in specially constructed padded, sealed, anti-shock, micro-climate-controlled cases. They will then be transported unobtrusively under the eyes of a minder. So yes, you could well be sharing a Eurostar train with La Belle Ferronnière. Their arrival in London will be staggered, their condition checked; being panel paintings they will have settling time and then they are in the National's care.

The whole enterprise is underwritten by the National Indemnity Scheme, without which the insurance costs would be such that no major exhibition could ever take place. The paintings are, of course, unsaleable but The Lady with an Ermine supposedly has an insurance value of £250m while, apocryphally, the Mona Lisa is valued at half a billion pounds.

The hanging of the pictures themselves takes two to three weeks and in this instance longer. It starts with a "paper hang", in which brown paper cut to scale is used to check the effect, and then up go the paintings themselves. Only when the National's art handling team has fixed the pictures to the walls can the lighting be finalised – usually on the last weekend before opening – so that paintings and drawings can be seen effectively and without glare, but without harming them either.

With the exhibition finally ready there is a press preview and TV and news access in the days before the official opening. And then, five years after that original conversation, the public will at last get to see these legendary pictures and, if Syson and the National Gallery have succeeded, focus only on the paintings and not what it took to get them there.