After having spent six years shepherding his second film, “Margaret,” through the byzantine corridors of Hollywood, playwright-screenwriter-director Kenneth Lonergan seems to be making up for lost time.

The scribe-helmer has just returned to the New York stage to write and direct what may be the biggest stylistic departure of his career, period comedy “Medieval Play,” set for a June 7 opening at Signature Theater. The bow is the inaugural production of his term in the theater’s new Residency Five program, which will see three new Lonergan plays produced by the midtown legit company over five seasons. He’s also planning to adapt his acclaimed Off Broadway plays for the screen and resume work on two original screenplays.

And in July, Fox will release the extended-cut DVD of “Margaret” as part of a Blu-ray combo pack via Amazon. It’s the ancillary coda to a film that began shooting in September 2005 but didn’t hit theaters until November 2011, due to creative and legal issues.

The 49-year-old Lonergan has spent years volleying between theater (“This Is Our Youth,” “Lobby Hero”), screenplays (“Analyze This,” “Gangs of New York”), uncredited script doctor assignments and work as an indie film auteur (“You Can Count on Me”).

If “Medieval Play” is any indication, Lonergan seems ready to take bigger creative risks than ever. While the comedy retains his recurring theme of examining moral dilemmas, it marks a radical shift in tone from the naturalism of his four previous Off Broadway shows and most of his screenplays. The tale of two 14th century French knights (Josh Hamilton and Tate Donovan) who grapple with the morality of war, politics and religion jumps from period dialogue to contemporary slang, sending up bad theatrical exposition and delighting in iconoclastic, gleefully profane moments, many of which seem designed to satirize current events.

“Somebody asked me whether I was consciously trying to say something about scandals in the Catholic church,” Lonergan says. “I wasn’t trying to draw any deliberate parallels. It’s set in a really crazy, passionate, hypocritical time rife with double standards. The parallels kind of take care of themselves.”

The comic tone of the new production is actually something of a return for him, says Lonergan, who adds that the “ultra-naturalism” — a style he began exploring in his 1996 breakout “This Is Our Youth” — people often associate him with developed after earlier writing similar to “Medieval Play.” “In my 20s, I wrote all kinds of things in this style, so it doesn’t feel like a departure to me,” he says. Lonergan wrote the first 15 pages of “Medieval Play” when he was 22, then revisited the project after touring old churches and castles on a trip to London.

His return to the stage following the 2009 play “The Starry Messenger,” with wife J. Smith-Cameron and Matthew Broderick, doesn’t mean he’s giving up on film work — despite the troubled and lengthy production process of “Margaret.”

Ongoing litigation prohibits Lonergan from discussing much about the film, but he maintains that the experience hasn’t soured him on filmmaking. “I was very happy with how (the film) turned out,” he replies. The tale of a teenager (Anna Paquin) who inadvertently causes a fatal bus accident, “Margaret” finally hit theaters in a 2 1/2-hour cut (the extended DVD version clocks in at more than three hours). One person involved with the film says the extended cut offers more aspects of several characters’ personalities and stories.

Lonergan is now working on another play he hopes to debut next year (“a much more naturalistic comedy, but less naturalistic than what I’m usually interested in,” he says) and he may resume work on two screenplays he’s started. “I might try to do one of those next year, or I may try to adapt ‘Lobby Hero’ or ‘The Starry Messenger’ into a film,” he says. “I’d like to eventually do all the plays as films.”

After the travails of “Margaret,” one wonders if Lonergan feels he has anything to prove to the industry.

“I don’t,” he says, pausing to contemplate his upcoming work. “I’d like to keep ultimately improving.”