Apostasy:
Those who have left Islam have historically fallen under three categories: those who left having never properly understood the religion often due to social circumstances, those who faked a conversion into Islam in order to undermine the Islamic community from within, and those who left to support opposing forces in battle against the Muslims. Because of the first category, Islam requires that the person who has chosen to forsake the religion be consulted with in order that his doubts may be clarified to him if there is any specific issue of confusion, or so that he may learn the proper Islamic teachings that he may otherwise have not been exposed to. As for the second and third category, this was the original reason behind the Prophet's statement on apostasy. The Qur'an records (3:72) that the Jews of Madinah decided to initiate the practice of pretending to accept Islam and then publicly declare their rejection of it, so as to destroy the confidence of the newly-converted Muslims. Thus, the Prophet Muhammad pbuh ruled that a punishment should be announced so that those who decide to accept Islam do so because of a firm conviction not in order to harm the Muslim community from within.
Muslims aren't the only ones who practise this law
If someone argues that this is something unique to Islam only, then it isn't. Look at how the
Spanish Inquisition [Reconquista] killed thousands of Muslims so that they would become Christians. Unlike the Spaniards in that scenario - who spied on Muslims in every way to find out whether they were hiding Islam in their hearts - the Muslims are ordered to accept what is at face value. i.e. if someone leaves Islam, the scholars have to answer the persons doubts and give them a time period (3 days) so they can think about it, ask more questions to clarify their doubts, and return back to their Islam.
If this person then accepts Islam, although in his heart he still hides disbelief - we accept his Islam at face value.
[add hadith of Usama b. Zayd]
http://i256.photobucket.com/albums/hh162/speed2kx/apst.jpg
The fact that he was given the opportunity to repent and return to islam shows that they were willing to answer his doubts if he had any.
If someone hides their disbelief in their heart, are they liable to punishment?
No. If someone hides their disbelief in their hearts, then no muslim can be suspicious on him and claim this person to be a disbeliever. This person has kept their disbelief in their heart, so it remains there. If however, this person spreads their disbelief and tries to influence others to leave Islam in the state, then he is causing harm to the society, and therefore he is liable to punishment.
A Matter of Allegiance.
When people become Muslim, they are pledging themselves to Allah [God], the believers, and the state. By disassociating yourself and breaking the pledge - you're committing apostasy, and even treason.
In many nations, including the US, the punishment for treason is death. In other states, its life imprisonment, and that is also like death (because you don't have any access to the world.)
If in those nations, its perfectly valid to punish someone for treason, then it is perfectly valid for the Muslims to make their own rules and decide what the punishment should be for one who commits treason, and spreads harm (even making others who are ignorant doubt their islam is a harm and form of corruption in society.)
It's a crime in many nations today (including the UK) to believe in the superiority of another ideology in comparison to Democracy. In Islam, it is a crime for a Muslim to believe that any other ideology is more supreme than Islam (because by him/her professing that islam is from Allah/God, they are by default agreeing that His law is the most supreme).
If someone professes this to others, then he is committing a crime and liable for punishment from the state (whether that state is the UK, or an Islamic state.) In both cases, the person will have to retract their statement and prove that they are loyal to their ideology - to be able to get their rights once again.