When he was a member of Congress from New York back in the 1980s, Robert Mrazek needed a place to find some peace and clear his head.

“I remember someone in the (congressional) gym telling me they knew of an island off Maine that probably had only one phone for the whole island,” Mrazek said. “I thought that was something worth checking out.”

Mrazek decided to visit the island, Monhegan. He fell in love with the place, bought a house and now lives more than half the year there.

So it’s not surprising that Mrazek’s first foray into filmmaking, “The Congressman,” is the story of a congressman (from Maine, not New York) who finds solace and inner strength by spending time on Monhegan. The film, written by Mrazek, stars Treat Williams, George Hamilton and Elizabeth Marvel, best known as Heather Dunbar in “House of Cards” on Netflix. “The Congressman” will get a test screening Wednesday at the Maine International Film Festival in Waterville.

The film was shot on Monhegan over 14 days in the fall of 2013. The crew also spent three days filming in Augusta, where the offices and hallways of the State House were used as a stand-in for the halls and offices of the U.S. Capitol.

The film is rare in that it was shot wholly in Maine, is set in Maine and was written and co-directed by a (part-time) Maine resident.

“Getting films like this made in Maine doesn’t happen as often as we’d like,” said Ken Eisen, program director for the film festival. “This film is home-grown, but it’s world-class. When you watch it, you can taste the salt in the air.”

Mrazek, 69, took a fairly roundabout route to filmmaking. After getting out of the Navy in 1968, he enrolled at the London Film School. But after the assassination of Sen. Robert Kennedy that year, Mrazek said studying film suddenly felt “trivial,” and he felt compelled to come home and do something that felt more constructive.

He picked politics, first working as a Senate aide, then becoming involved in New York state politics. He won election to the U.S. House of Representatives in 1982. After leaving the House in 1993, Mrazek said, he decided to try to make a living as an author, which he has been able to do. His books include thrillers, Civil War fiction, mysteries and nonfiction about World War II.

The idea to try to make this film came to him, at least partly, because he’s not one to sit idle. While spending time on Monhegan in 2012, Mrazek finished writing a novel and realized he wasn’t scheduled to leave the island for two more months. So he thought the time and quiet would be perfect for writing a screenplay.

The story came partly from Mrazek’s experiences on Monhegan after years of watching year-round residents rely on hard work and each other to overcome obstacles. It also came partly from his own experiences in Washington and his view of the “greed and corruption and special interests” that dominate politics today.

In the story, Maine Congressman Charlie Winship (Williams) is shown on TV cameras failing to stand to recite the Pledge of Allegiance. Media and citizens are outraged. To make things worse, he punches another House member. Then he finds himself on Monhegan, during a fishing feud, trying to explain what he did.

“It’s about what it means to be an American, and we’re taking on some traditional attitudes about the Pledge and other symbols, specifically that the Pledge was somehow brought down from Mount Olympus,” said Mrazek. “I think a lot of movies tell people what to think. I wanted one that just made people think.”

Much of the film follows Winship on Monhegan, dealing with his constituents. Scenes were shot outdoors, near the water and in the homes of year-round residents.

Mrazek was able to get backing for the film because his book agent was able to get his screenplay in the hands of Fred Roos, a legendary Hollywood producer whose films include “The Godfather: Part II,” “Apocalypse Now,” “Lost in Translation” and “St. Vincent.”

It was Roos, Mrazek said, who was able to attract a veteran Hollywood cast and entice them to come to Maine to make a small-budget film.

“We were sitting in Augusta one day, and George Hamilton told me he’d go anywhere (Roos) wanted him to,” Mrazek said.

Hamilton, 75, has had a nearly 50-year film career and is probably best known for lead roles in “Love at First Bite” (1979) and “Zorro, the Gay Blade” (1981). He plays a lobbyist.

Williams, 63, first gained fame in the film version of “Hair” (1979). His other better-known films include “Prince of the City” (1981), “Once Upon a Time in America” (1984) and “Mulholland Falls” (1996). This year he starred in the NBC dramatic series “American Odyssey,” which was canceled after one season.

Other members of the veteran cast include Ryan Merriman, Jayne Atkinson, Josh Mostel and Fritz Weaver.

Mrazek plans to be at Waterville for the screening and will take questions from the audience. He says he hopes to bring the film to festivals and then get a theatrical release for it.

Mrazek thinks the film might be controversial and might not be for all moviegoers.

“It probably won’t play the same theaters that play ‘Jurassic World’,” Mrazek said, “but my hope is it can be seen by a broad audience.”