Why is the legacy of colonial powers a barrier to democracy in the Middle East?

When did these countries have a chance to learn to operate a democracy?