Making jokes about the Middle East is not a safe bet.

“The Brink,” a new HBO comedy that begins on Sunday, has a line that refers to Americans being beheaded on YouTube. It’s discomfiting, but that’s the closest the show gets to that kind of offensive humor. (There are other sorts.)

The writers don’t go any nearer to Islamic extremism or terrorism. Instead, the creators of “The Brink” take aim at American wrongdoing.

So nobody is going to get in trouble because of this show. But people aren’t going to die laughing, either. Tim Robbins plays Walter Larson, a sex-crazed secretary of state, and Jack Black is Alex Talbot, a brash, ignorant low-level State Department bureaucrat in Islamabad. It’s called “The Brink” because the unlikely pair cross paths in the middle of a geopolitical crisis: A demented general seizes power in Pakistan and threatens nuclear attacks on Israel and India.

The series finds its comic stride in the fifth episode and becomes kind of fun. But that’s a long wait, and it’s easy to be discouraged by the way it starts.