Image copyright Adrian Rogers Image caption Hinterland is filmed in locations across mid Wales

It has been described as a "modern-day Western", but, as the third series is screened, just what is it about the setting of Welsh police drama Hinterland which has made it appeal to 100 countries?

It is a rainy Tuesday morning in Llanybydder, Carmarthenshire, fog has descended and there is drizzle in the air.

Low clouds hang around a dilapidated former boarding school where the cast and crew of Hinterland are filming the latest, and possibly last, series of the detective noir.

Inside, mould patches spread up the walls of the building, which had been left derelict after its most recent residents - an Islamic college - closed in 2012. It is the place where Michael Adebowale - one of Lee Rigby's killers - studied.

Now make-up bags sit on the school desks, and extras sit reading books and doing crosswords in the old canteen at tables in complete silence, for fear of disturbing filming.

The weather outside swings from bright sunshine to fog so thick you cannot see the rolling hills in the distance.

It is isolated settings such as this in mid Wales which have been partly credited with the detective noir's success.

Bought by TV stations in scores of countries including Canada, Scandinavian nations and Australia as well as by Netflix, Hinterland has become a poster-child for EU funding with grants covering 15% of the cost of making it.

Richard Harrington, who plays DCI Tom Mathias, said: "It fits really well here and there are faces here you can't replicate anywhere else because of the weather system, because of the geology of the place."

Media playback is unsupported on your device Media caption Mali Harries talks about how the mid Wales countryside features in Hinterland

And certainly the mountainous terrain and sweeping landscapes are expected to continue to feature heavily.

Hinterland is produced in English and Welsh, and is shot in both languages one after the other.

Actress Mali Harries, who plays DI Mared Rhys, said: "The scenery and landscape play a massive role. I would say about 95% of the scenes are outdoors, so we are in the hands of the gods as regards to the weather that we've had.

"The scenery is astonishing; you are taken to places that you have never seen before, places where there are no people for miles and miles.

"I think it has become a character in itself really, the landscape, as we are little cogs in the picture."

The programme, now in its third series, has won plaudits across the world.

Image caption The latest series of the Welsh version of the programme Y Gwyll was screened on S4C last year

Image copyright Adrian Rogers Image caption Many locations are found by word of mouth, while others have been found by people contacting the show directly

Mrs Harries added: "I think maybe the location is partly why a lot of other countries have invested into it.

"It is the best office that Rich and I will ever get to work in."

The Welsh version of Hinterland - called Y Gwyll - has already been shown on S4C ahead of the English version being broadcast on BBC One Wales and iPlayer, then BBC Four.

Producer and co-creator of Hinterland Ed Talfan said the landscape had been a key part of the programme from the start, but that it presented challenges to the makers.

"From the beginning we had the sense of trying to make a Western," said Mr Talfan. "I think the show in all sorts of ways is obsessed with its location.

"In many ways it is a blessing but it can also be a challenge when you work in a county that doesn't have any motorways and so when you are trying to move an army from A to B, it can be a bit of a drag."

Image caption There have been 13 90-minute episodes of Hinterland filmed

Image copyright Warren Orchard Image caption Richard Harrington and other cast members spent months filming the latest series in mid Wales last year

The production team filmed in different locations almost every day, moving 40 crew, cast and extras with them. Many of those working on the series moved to mid Wales while filming took place.

But Hinterland was very nearly not made in the Welsh countryside - but on a studio lot in Cardiff.

Paul "Bach" Davies, Hinterland location manager, said: "When I was asked to do Hinterland we originally thought we were looking for a few places to do exterior shots of remote farmhouses and some green land, and that the rest would be filmed in Cardiff.

"But when we started uncovering these gems we thought this has to be here. It was incredible - we found all sorts of places.

"On a number of occasions I found the place and they wrote scenes to that location, which is unheard of. They could mould that location to the character, which is a huge coup for me."

Hinterland will be shown on BBC One Wales on Wednesday 5 April at 21:00 BST