My friend made a mistake, and then we had a very good relationship, and then I took the fall for him, and then the head teacher forced me to threaten me, and then I admitted it.
No matter how good the relationship between friends is, you can't take the blame. You should ask your friend to go to the head teacher to admit his mistake. This is a wise move!
Now that the teacher knows what happened, you did the right thing. He is unhappy. That's his business. Let him go!
We don't need to pay for our friends' mistakes, just have a clear conscience!