Casey Affleck will star in the vigilante thriller “Villain,” based on a screenplay that he also wrote.

Mikael Marcimain will direct, with Teddy Schwarzman and Ben Stillman producing via Schwarzman’s Black Bear Pictures banner, along with Affleck. Sierra/Affinity is handling international sales for the project at the American Film Market, which launches on Wednesday.

The movie is set in a city overrun with crime. Affleck’s character loses everything of meaning in his life when a brutal home invasion leaves his family dead and two bullets lodged in his head. He develops a unique power in the wake of his trauma — an ability to see into people’s pasts, presents, and futures — and goes on a mission of revenge to find the men who killed his family, and in the process clean up his city long overdue for justice.

But as his vigilante acts become more frequent and violent in nature, his arrival as the city’s hero may instead be the announcement of its most prolific villain.

Affleck will next be seen starring in Kenneth Lonergan’s awards contender “Manchester by the Sea” with Michelle Williams. He recently appeared in “Triple Nine.” Sierra/Affinity handled international sales on both titles.

Marcimain won the international critic’s award at the 2012 Toronto International Film Festival for “Call Girl,” and directed the Netflix miniseries “Gentlemen & Gangsters.”

It’s the second AFM project starring Affleck that was annouced on Friday. He’s also attached to star with Robert Redford in “The Old Man and the Gun.”

Marcimain is represented by Cinetic, CAA, and Agent Firman. Affleck is represented by WME. The news about “Villain” was first reported by Deadline Hollywood.