‘Clouds in Britain were very different from Japanese clouds,” says director Hiromasa Yonebayashi. “They seemed very close and they went on forever. They really stirred the imagination. I felt like those clouds had been an inspiration for British writers to create lots of fantasy works. It looked as if some hidden castle were about to emerge from them.”

It’s rare the tourist who comes to Britain and enthuses about our overcast skies, but Yonebayashi and his team were on a mission. They were researching for their new animated feature Mary and the Witch’s Flower, based on the 1971 children’s book The Little Broomstick by Mary Stewart. The story is set in rural Shropshire, where a country girl’s discovery of a magical flower whisks her into a world of witchcraft and adventure. Yonebayashi opted to retain the original setting, so despite being Japanese in name and manufacture, the film feels quintessentially and unmistakably British, from the chintzy furnishings to the toaster in the kitchen to the herbaceous borders in the garden.

‘We really needed to visit England’ … Hiromasa Yonebayashi. Photograph: Kevork Djansezian/Getty Images

Fantasy is most effective when it is grounded in a solid reality, Yonebayashi suggests: “For example, we do not have a culture of witches in Japan, so when we wanted to portray the concept of witches, we really valued [Stewart’s] original ideas. Also, in the original book, nature is very beautifully and carefully portrayed: forests, gardens, flowers and plants, so we really needed to visit England to see the actual setting.”

Yonebayashi is best known for his films When Marnie Was There and Arrietty, both made with Studio Ghibli, Japan’s pre-eminent animation house. The announced retirement of Ghibli’s founder and resident genius auteur, Hayao Miyazaki (who subsequently changed his mind), resulted in Yonebayashi in setting up his own Studio Ponoc after Ghibli disbanded its production division in 2014. The continuity is evident in the vibrant, hand-drawn animation and themes of prepubescent female self-identification, but also in the source material: all three of Yonebayashi’s movies have been based on books by British authors. When Marnie Was There was an adaptation of a 1967 novel by Joan G Robinson, while Arrietty was of Mary Norton’s classic The Borrowers. Those were transposed to Japanese settings, largely for the benefit of domestic audiences. Given the choice, Yonebayashi opted to set his latest in England.

Magical adventure … Mary and the Witch’s Flower. Photograph: Altitude Film

It was his first visit. “We were familiar with English scenery through such works as Peter Rabbit and Thomas the Tank Engine,” says Yonebayashi. “What was different from what we imagined was the colours of trees and leaves and flowers. So many different tones and shades!” From their bed and breakfast in Leintwardine, the directo, his producer and art director toured the Shropshire area viewing local manor houses, consulting the UK’s National Gardens Scheme’s Yellow Book for gardens to visit, asking locals what to see. Yonebayashi is full of enthusiasm, for the landscape, the hospitality he received, the soft fruits, even the cuisine. “We had an English breakfast every morning and it was fantastic. However, at times we felt that we wanted to eat something else.” Not even the constant rain fazed him. It reminded him of his home town in Ishikawa prefecture, roughly halfway along Japan’s northern coast. “There is a proverb in my region: even if you forget your packed lunch, don’t forget your umbrella.”

Looking back, Studio Ghibli has always had a bit of a love-in with Europe in general, and Britain in particular. As a student, Miyazaki became interested in children’s literature, including the works of Rosemary Sutcliff and Philippa Pearce. Last year, he published a list of his 50 favourite children’s books – 20 of them were British. He made trips to Italy and Sweden in the 1970s when he was attempting (unsuccessfully) to adapt Heidi and Pippi Longstocking, and many of his early features have quasi-European settings, from his debut, Castle of Cagliostro (set in a fictional European state) to 1920s aviator tale Porco Rosso (set in the Adriatic) to Kiki’s Delivery Service, another tale of a girl witch, whose location was primarily modelled on Stockholm.

Stockholm-set … Kiki’s Delivery Service directed by Studio Ghibli’s Hayao Miyazaki. Photograph: Sportsphoto/Allstar/Buena Vista

Most intriguing of all is Miyazaki’s 1986 fantasy adventure Castle in the Sky, a tale of airborne pirates, technological terrors and a mythical floating city which does, indeed, emerge from the clouds (it is named Laputa, after the flying island in Jonathan Swift’s Gulliver’s Travels). The story’s boy hero lives in what looks like a 19th-century mining community. It is based on Wales, which Miyazaki first visited in 1984, just after the miners’ strike. The country seems to have struck a chord. “I really admired the way the miners’ unions fought to the very end for their jobs and communities, and I wanted to reflect the strength of those communities in my film,” he told an interviewer in 1999. “I saw so many places with abandoned machinery, abandoned mines – the fabric of the industry was there, but no people. It made a strong impression on me.” He also related to the Welsh and other Celtic people’s struggle for nationhood and cultural identity, in the face of outside invasion since Roman times. Two decades later, he adapted a novel by Welsh author Diana Wynne Jones, Howl’s Moving Castle.

As with Hollywood, Japan’s anime and manga industries are so huge and prolific, they are constantly hungry for source material, so it is almost inevitable some are set in Britain. The Victorian, steampunk-friendly era is a particular favourite. Katsuhiro Otomo followed up his legendary Akira with 2004’s Steamboy, set in Victorian Manchester and London and taking in the Great Exhibition of 1851. Black Butler, AKA Kuroshitsuji, is a supernatural spy tale that crosses paths with Queen Victoria and Jack the Ripper. Emma follows a servant girl in class-conscious 1850s London. Read or Die centres on an agent for the “special operations division of the British Library”.

Here in the UK, we may question why Japanese animators are more engaged with our rich literary heritage than the domestic film industry seems to be. There is often uproar when Hollywood co-opts Japanese stories and culture, such as the recent remake of Mamoru Oshii’s Ghost in the Shell, or Netflix’s US-set adaptation of hit manga Death Note. Isn’t this the same thing? Should we be affronted? Not if it’s done in the right way, says producer Yoshiaki Nishimura. “When we create works based on overseas culture, we really want to respect their countries and the original concepts the author wanted to portray.” By the same token, he appreciated Sofia Coppola’s Lost in Translation, which viewed modern Tokyo with the same curiosity he viewed Shropshire.

Remake/remodel … Scarlett Johansson in Ghost in the Shell. Photograph: Jasin Boland/AP

Yonebayashi remains on good terms with Miyazaki and Studio Ghibli, he says. He worked there for 20 years before setting up on his own, and his latest film looks and feels like a continuation of Ghibli’s work. Asked to make a distinction, he suggests: “The late Studio Ghibli works tend to end with departures. However, when creating movies for children currently, I thought it was more important to show encounters than partings.” The sentiment feels in tune with his cultural eclecticism.

Perhaps we should be grateful. Films such as Mary and the Witch’s Flower are expensive and time-consuming to make, with their painstakingly hand-rendered images and attention to detail. They are an endangered art, which is why few countries outside Japan still make them. It is hard to imagine anyone could have done a better job. If Britain no longer has the industry, it at least has the stories.

Next, Ponoc has its eye on Scottish writer Alex Shearer. “I’ve read all his works,” says Nishimura, “and I would really, really love to make a film out of one of his books.” This time, at least, we Brits beat them to it: BBC adapted Shearer’s story Bootleg into a Bafta-winning miniseries in 2002. Mind you, it was also made into a Japanese anime feature in 2008.

• Mary and the Witch’s Flower is now on release