Suicide is illegal — Learn to Play Go
In our rules, you cannot play a stone that leaves your own group without liberties.
Black cannot play E5 here: it would have no liberties and capture nothing. Choose an open point instead.
Captures are removed first. Playing into a surrounded point IS legal if it captures and creates liberties.