Lonergan directed his own screenplay for "You Can Count On Me" (2000); the film, which was executive produced by Martin Scorsese, went on to receive and be nominated for numerous writing awards. He contributed to the screenplay for "Gangs of New York" (2002). In 2005, filming took place for his second film as writer/director, "Margaret", starring Anna Paquin, Matt Damon, Matthew Broderick, and J. Smith-Cameron. The film spent over five years in post-production, with Lonergan, the producers and various editors unable to agree on its final cut, resulting in multiple legal disputes. It was finally released in 2011. "Margaret" ranked 31st in a 2016 BBC poll of the 21st century's greatest films.