Kirk: Once Again, we've saved civilization as we know it.
Bones: And the good news is, they're not going to prosecute.
Uhura: They might as well have prosecuted me. I felt like Lt. Valeris.
Bones: (To Spock) Well, they don't arrest people for having feelings
Chekov: It's a good thing too. If they did, we'd all have to turn ourselves in
I never quite understood this exchange. There was a little bit more to arrest them on than having untrustworthy feelings. They framed the Enterprise for the murder of several Klingons, including the high chancellor, they orchestrated an assassination attempt on the Federation president, & nearly succeeded, they wrongfully imprisoned Kirk & McCoy, a battle was fought, the Klingon Bird of Prey prototype was destroyed, and they conspired to start a war.
Basically, Lt. Valeris, Admiral Cartwright, & Colonel West are all perpetrators of high treason. How do you NOT bring charges against them for that? & if that's the case, why don't they just return Valeris to her post at helm in the ending. I mean c'mon Kirk got demoted for disobeying an order. They must have an order that says don't commit treason.