The LA-based screenwriter had just put down a pet when he and his wife went to the pound to look for a new companion. “We like big dogs,” Lettich, 64, says. “We wanted something like a German shepherd.”

As luck would have it, the shelter had a litter of what looked like four German shepherd puppies. Lettich and his wife took two, and named the pair Tina and Charlie.

But as the pups grew, Lettich realized they didn’t look like other German shepherds in the neighborhood. Months later, he found out why.

“I was reading an article about the bomb-sniffing dogs at LAX, and there’s a photo of a dog accompanying it that looked exactly like my dogs. The article
stated it was a Belgian Malinois, and I thought, ‘What the hell? What’s this?’ ”

Lettich fell in love with the breed. “They’re a bit of a handful, especially when they’re puppies,” he says. “But once they bond with you, they’re very loving pets.”

Fifteen years later, his Belgian Malinois inspired Lettich to write a script starring a dog of the same breed. “Max,” a family flick about a war dog relocated from Afghanistan to Texas to live with his handler’s family after his death, arrives in theaters Friday.

The military and police switched to the Belgian Malinois several years back, finding them better suited for the work than German shepherds, explains Lettich, who adopted a third Belgian Malinois, Zoe, a few years ago, after Tina and Charlie had passed away.

“They’re a little bit smaller, lighter, more agile; they can be very aggressive, they live a little bit longer, and they don’t have hip-dysplasia problems as much as German shepherds do.”

In the film, Max — who suffers from PTSD following the death of his handler, Kyle Wincott (Robbie Amell, best known as Firestorm on “The Flash”) — moves to Texas to live with the Wincott family and adapt to “civilian” life. Kyle’s younger brother, Justin (Josh Wiggins), is put in charge of the unruly canine.

Max is held by actor Josh WigginsKent Smith

Five different Belgian Malinois were used to play the titular role, but the main one was Carlos, who portrays Max in 90 percent of the shots.

“[He] was the one who did all the heavy lifting,” says director Boaz Yakin. “When there was a close shot, or an action shot, it was Carlos.”

Carlos mastered a number of tricks integral to the film’s plot — including tracking the scent of the villain, Tyler (Luke Kleintank), and attacking him in the film’s climax.

“In the movie, we call Max the ‘Air Jordan of dogs,’ but really, he’s the ‘Rambo of dogs,’ ” Lettich quips of the canine’s aggressive tactics.

The idea to write a dog-centric flick came to Lettich and Yakin after watching the 1994 film “The River Wild,” starring Meryl Streep. Her dog, Maggie, takes off as soon as the bad guys attack. “That movie needed a kick-ass dog,” says Lettich.

But he was still stumped when it came to a possible plot — until dogs started returning stateside after serving in Iraq and Afghanistan. When Lettich served in Vietnam, most of the war dogs were euthanized rather than being sent back to the States — but that policy changed in 2000, when President Bill Clinton signed a law allowing dogs to be adopted by their handlers or civilians.

Kent Smith“To me, that sounded like a great premise for a hero-dog movie. You’ve got a war dog that does things that a normal dog just won’t do.”

Lettich and Yakin are mum on Max’s fate, but the two have been stunned by the number of people bracing themselves for his demise.

“People are saying, ‘Tell me if the dog dies! I just need to know if the dog dies!’ But no one says, ‘I can’t watch this movie because people die in it,’ ” says Yakin.

“We can put up walls when it comes to our own species dying, but there’s something about dogs that causes people to lose their cynicism and drop their defenses.”