John Krasinski saved Jim and Pam’s relationship in The Office

PHOTO: Twitter/pbjmoments

John Krasinski saved Jim and Pam's relationship in The Office.

The 42-year-old actor refused to follow a script presented to him by showrunner Greg Daniels which would have seen his alter ego Jim Halpert — who was married with two kids to Jenna Fischer's character Pam Beesly-Halpert — making out with Cathy Simms (Lindsey Broad) in a hotel hotel room while they were both on a Dunder Mifflin Paper Company work trip to Florida in season eight episode After Hours.

The Quiet Place actor made the revelation to Brian Baumgartner — who played accountant Kevin Malone in the show, which was inspired by Ricky Gervais' British sitcom of the same name, that ran on NBC between 2005 and 2013 — in his new book, Welcome to Dunder Mifflin: The Ultimate Oral History of The Office — which is based on hours of interviews with the cast, some of which come from his podcast An Oral History of The Office.

John recalled to Brian how "that's the only time I remember putting my foot down … I remember saying things that I never thought I'd say before, like, 'I'm not going to shoot it.'"

He mused that there was a "threshold" that "dedicated" viewers could take with beloved characters.

John — who is married in real-life to actress Emily Blunt, 38, with whom he has two daughters, Hazel, eight, and five-year-old Violet — continued: "There is a threshold with which you can push our audience. They are so dedicated."

The Jack Ryan star acknowledged the sitcom has displayed "great respect" to viewers but was weary to alienate them, such as showing Jim having an affair.

John said: "We have shown such great respect to them. But there's a moment where if you push them too far, they'll never come back. And I think that if you show Jim cheating, they'll never come back."

Greg obviously took on John's opinions as Cathy's attempt to woo Jim was ultimately sabotaged by Dwight Schrute — played by Rainn Wilson — who doused the pair in bug spray.

READ MORE: Star Trek: Discovery leaves Netflix globally before season 4 debut