Can kings in medieval times get away with murder? I dont mean framing/causing someone of treason/adultery. But just straight up murder. I mean like just pull out a dagger and thrust the dagger into his wife/fellow lord/peasant chest in front of all the members of court just for funzies? Could the king get away with it scot free?
As far as i'm aware it wasn't until Charles I of England in the English Civil war when a sitting monarch was actually tried for crimes, of which murder among others was included, and punished for them, and even in this case many at the time and many historians today considered Parliament's legal authority to bring the king to trial dubious. That is not to say though that murdering someone in cold blood for no apparent reasons wouldn't still potentially have religious and socio-political consequences or be strictly legal. I am in this mostly going to talk about western europe because while things like the relationship between monarch and subject in places like Poland and Hungary is interesting i don't feel i have enough depth of knowledge to comment and English history in greater detail.
Now from fairly early on in the high medieval period English kings are of their own volition or under political pressure accepting that handing out death penalties should generally not be an entirely arbitrary matter. With the Assize of Clarendon in and Magna Carta the former established that trial by jury was to be the method of trial over more arbitrary ones such as trial by combat. Magna Carta helped to assure that
No free man shall be seized or imprisoned, or stripped of his rights or possessions, or outlawed or exiled, or deprived of his standing in any way, nor will we proceed with force against him, or send others to do so, except by the lawful judgment of his equals or by the law of the land.
To no one will we sell, to no one deny or delay right or justice.
However it was fairly rare that even after the statute became more permanently binding later in that century after some back and forth it still would still be extremely rare that these clauses were successfully used as any kind of legal defence to prevent punishments without trial.
So beyond that in terms of things like religious consequences increase in severity based on how arbitrary it would have generally been perceived and how high status the victim was. For example it was certainly a big deal when in a fairly round about manor king Henry the II (only five years after he main the Assize of Clarendon) more or less asked members of his house hold to deal with the archbishop of Canterbury Thomas Becket after a political dispute surrounding coronation. Four knights after attempting to drag the Becket from the cathedral hacked him to death there and then.
Henry quickly realises he's stepped beyond what he should have done and in order to avoid potential excommunication and other social, religious and political consequences of the murder he has to engage in a very public display of penance while the knights themselves are sent the holy land to serve their as their form of penance.
So while Henry certainly avoids the possibility of being put of trial or receiving any other personal punishment its clear that this has consequences.
Now for a case where a King (or at the time he did it a man who claimed the right to the throne but wasn't yet crowned) personally killed someone lets look at Robert the Bruce and John Comyn/ the red. Whether this was murder and the morality of this is a rabbit hole i don't want to go down seeing as that's a question laced with a lot of national pride right up until till today. But while the political background is pretty complex effectively Edward king of England is supposed to pick one of the two of them to be king of Scotland after his first two plans went wrong but its delaying doing so while he tries to find a way to get more influence in Scotland and work out a deal that'd favour him so he's put of making the choice for a while. John and Robert agree to meet in a church before the altar to talk, at this meeting Robert killed John, landing at least one of the blows that killed him with his own blade. Whether Robert planned the killing and why is a contested matter, you might have seen one version of events in The Outlaw King recently and while that picture isn't entirely implausible its filling in the gaps in the agreed upon details of the event in the most favourable way that's plausible. Certainly what the Comyn family and English accused Robert the Bruce of doing was luring John Comyn in and murdering him at a parlay in a church to clear his path to the throne. Now obviously the long term consequences of this weren't so great that Robert lost the war with Edward and his supporters but he was excommunicated for it, he had to fight that war there and then and produced retaliatory measure such as refusing to give quarter to Robert's supporters and the battle of Methven a few months later.
So to summarise a king was unlikely to ever be tried to murder during the medieval period itself but the repercussions of doing something like that, particularly if the victim was high status and/or if the murder took place in a religiously charged context the move would have serious consequences.