BERLIN — Germany has one of the biggest free TV markets in the world, but despite some 30 commercial rivals and plenty of U.S. fare on air, it’s pubcasters ARD and ZDF that lead in the ratings, year after year.

The pubcasters generally attract older, loyal viewers, but hit shows on ARD and ZDF also regularly garner the younger demos targeted by the commercial competition.

Indeed, ARD’s weekly medical drama “In aller Freundschaft,” about a group of young doctors working at a clinic in the city of Leipzig, has become one of the country’s most-watched shows, thanks in part to its appealing cast and smart, timely storylines.

Likewise, ARD’s “Tatort” has been dazzling auds since its premiere in 1970. While the skein has evolved through the times, it’s also gained a cult status across generations: The Sunday-night mainstay is just as likely to attract loyal followers at a retirement home in rural Bavaria as it is in a trendy bar in Berlin.

Part of the success of both “In aller Freundschaft” and “Tatort” can be attributed to the timeliness of their storylines, which often seem ripped directly out of the headlines.

Last year, “In aller Freundschaft” celebrated its 300th episode with a storyline that focused on bird flu and triggered a storm of criticism from government officials, who accused series producers of instigating panic among the television-viewing population at a time when the media were following the growing bird flu epidemic from Asia to Europe.

Similarly, an episode of “Tatort” about an enraged, gun-wielding mother who blamed a mobile network operator and its cellular phone masts for the leukemia that killed her daughter, infuriated local network operators when it aired, just days before the start of the IFA consumer electronics fair in Berlin. While industry reps accused “Tatort” producers of grave irresponsibility, damaging the image of mobile telcos and spreading unnecessary fear, ARD stood by the episode and its own research, saying there was no concrete proof that cellular masts were indeed safe.

“We don’t tell any stories in the formal sense,” contends Hans-Werner Honert, topper at Saxonia Media (which makes “In aller Freundschaft,” “Tatort” and “Polizeiruf”). “We’re more concerned with exploring (conflict with) our viewers. That brings us closer to them and their lives, and it’s why they reward us with high ratings.”

While not all the pubcasters’ leading shows are that edgy, they remain just as appealing to the pubcasters’ older-skewing auds, which far outnumber the key 14-49 demo favored by commercial webs.

ZDF’s “Die letzte Zeuge” (The Last Witness), about a police forensics specialist, has remained a major hit since its launch in 1998, although the future of the series remains unclear following the recent death of star Ulrich Muehe, an immensely popular actor who also appeared in the Oscar-winning bigscreen drama “The Lives of Others.”

With a combined budget of some $10 billion from license fees, in addition to limited advertising revenue, ARD and ZDF are not under the kind of pressure for instant results facing commercial rivals and can afford to give new series plenty of time to develop their auds.

One of ZDF’s longest-running and most-watched series is the “Love Boat”-like cruise liner skein “Das Traumschiff,” which premiered in 1981 and regularly takes passengers and viewers to exotic locations around the globe. The show, which has gone through numerous ships and crews, recently attracted 6.2 million viewers with an episode set in Thailand, giving it an impressive 19.2% share in early September.

“When it comes to the good old TV drama and today’s TV movie, ARD and ZDF have decades of tradition and experience in dealing with material, casting and direction,” says “Das Traumschiff” producer Wolfgang Rademann of Hamburg-based Polyphon. “Quality and not popularity was always the kicking-off point.

“Today, quality and viewers’ wishes are mixed professionally. Authors, actors and directors are, despite stagnating budgets, still in the position to push through quality. Which is why German TV movies are watched around the world.”

Simon Kingsley contributed to this report.