Opposition to the largely Muslim nation 's membership in the European bloc contributed to the defeat of the EU constitution in recent referenda in France and the Netherlands .