Everyone thought we were crazy when we said we were going to the Palestinian territories in search of comedy. You mean the war-torn region that’s been under Israeli occupation for decades? A place that’s synonymous with suicide bombers and Israeli army incursions?

Oh, sure, they’d crack. It’s going to be hilarious.

But this is exactly what we discovered during our travels in the West Bank: lots of comedy. In a busy cafe in the capital city, Ramallah, we met a young woman who considered it utterly hilarious that her parents had named her Hurriyah Ziada — Arabic for “extra freedom.” Nearby at Birzeit University, we learned that anthropologist Sharif Kanaana has dedicated his career to collecting and archiving the thousands of Palestinian jokes he’s heard — including one in which various heads of state meet with God and make requests for their people. To each, God says, “Not in your lifetime.” Then Yasser Arafat, the former Palestinian leader, asks for his people’s freedom. God replies, “Not in my lifetime.”

We learned from a group of men sharing a bubbling hookah pipe one evening that Palestinians are constantly gauging where they stand on the unofficial ladder of Arab comedy. They figure they’re less funny than Egypt, a place so full of jokesters that during the presidency of Gamal Abdel Nasser, a special intelligence unit monitored wisecracks about the government. But they’re sure they’re funnier than Jordan. “Have you heard the one about the Jordanian businessman?” one of them asked. “Every morning before work he puts on his shirt, tie and angry face.”

Later, we got to know stand-up comic Adi Khalefa, who claims to be the funniest guy from Nazareth since Jesus. He talks about getting on a plane in Israel and noticing a sign on the bathroom reading “Occupied.”

“Not just Palestine is occupied, the bathroom on the airplane is occupied?” he cries, before launching into a faux nationalistic chant: “From the river to the sea, our bathroom will be free!”

Finally, we met the stars of “Watan ala Watar,” Arabic for “Homeland on a String,” the first Palestinian political-satire TV show. Despite the fact that the program aired on state-run television, no one was off limits: Palestinian leaders, Israeli negotiators, Osama bin Laden, Barack Obama. One skit featured an Islamist judge in Gaza making eyes at a male courtroom reporter.

In 2010, a polling organization found that 60 percent of those in the West Bank and the Gaza Strip who’d seen “Watan ala Watar” liked it — a far higher approval rating than either of the Palestinians’ main political parties.

We weren’t surprised to find comedy so pervasive and popular in the West Bank. That’s because we’re partial to the benign violation theory, a new explanation of what makes things funny that McGraw, the academic half of our duo, has been developing with Caleb Warren, an assistant professor of marketing at Texas A&M University. According to the theory, humor arises only when something seems wrong or threatening but is simultaneously seen as OK or safe. All kinds of humor appear to fit the benign violation theory: A dirty joke trades on moral or social violations, but it’s going to get a laugh only if the person listening is liberated enough to consider subjects such as sex OK to talk about. Puns can be seen as linguistic violations that still make grammatical sense.

This theory also explains why we found so much humor in the Palestinian territories: The place is full of violations waiting for some joker to make benign.

It’s clear from the history of comedy — from the romantic mix-ups of Shakespeare’s “A Midsummer Night’s Dream” to the violent gags of “Jackass” — that a lot of laughs can be mined from trouble and turmoil. It’s why stories abound of humor taking root in Nazi concentration camps; it’s why hefty tomes have been written on the wealth of “anekdoty,” or jokes, coined by the Soviet citizenry during the dispiriting years of the USSR. “

But sorrow, trouble and turmoil have done more than just give rise to a lot of comedy in the West Bank; such circumstances have also defined the very essence of Palestinian humor. The jokes we discovered were for the most part dark, sardonic and self-deprecating.

These jokes, in other words, are what many people consider “Jewish humor,” the sort of wry self-ridicule folks associate with Woody Allen and Larry David.

When you think about it, it makes perfect sense that Jews and Palestinians would employ similar approaches to comedy. Both cultures are defined by struggle and hardship, so it’s only natural that they at times turn to humor as a psychological salve, a form of self-preservation. They have learned to put themselves down before their enemies have a chance to do so.

Is a shared sense of humor enough to solve the Israeli-Palestinian crisis once and for all? Surely not — but a few shared laughs is a step in the right direction.

Joel Warner is a journalist in Denver. Peter McGraw is a marketing and psychology professor at the University of Colorado at Boulder, where directs the Humor Research Lab. They are the co-authors of “The Humor Code: A Global Search for What Makes Things Funny.”