Jack's faced his demons and won
The sword was returned to the samurai following an extended meditation atop a mountain as Ashi fought off an army of his enemies (including her own mother). Jack's mental wanderings took him to a teahouse located in a kind of spirit realm, where a short old man told him he had to make tea in a traditional Japanese tea ceremony.
Jack made the tea perfectly, but it tasted "terrible," the old man said, because he did not have the crucial ingredient: balance. Jack immediately manifested a hateful avatar of himself that resented the man's implication, but Jack -- after the events of this season -- conquered that hatred, and banished the vile version of himself away. Don't expect to see any of these mean-spirited Jacks again.
Once he did that, the gods handed him back his sword.