If you are learning martial arts for self-defence purposes, it is essential to know the self-defence laws of the country you live in. Laws vary from country to country, and may be specific to the social context (e.g. gun laws in the USA. Also remember that different states may have their own local laws).
The UK laws are described in the following links. We highly recommend that you read them thoroughly.
“It is both good law and good sense that a man who is attacked may defend himself. It is both good law and good sense that he may do, but only do, what is reasonably necessary.”
“A person may use such force as is reasonable in the circumstances in the prevention of crime, or in effecting or assisting in the lawful arrest of offenders or suspected offenders or of persons unlawfully at large.”
What this means:
You may, but are not legally obliged to, use reasonable force in response to an attack, or to defend another person, or to defend property, or to prevent a crime, or for lawful arrest.
“Reasonable force” means proportional to the severity of the attack, and used only if absolutely necessary. You must hold a genuine belief that your response was necessary and adequate in the circumstances.