It seems that the problems start when the previous (secular) rulers get booted out.
Much of North Africa appeared to be run that way, until the "Arab Spring".
Perhaps Islam is fine as a religion per se, but not much good as a stable way to actually run a country?