Heck, not even that - just don't threaten the families with prosecution, and use prosecutorial discretion. In a dog-eat-dog world with a nation against a bunch of pirates, and the law forbidding ransom to the pirates, it is beyond stupid to announce it is okay to pay ransom to the pirates.
Tough spot for any families with hostages. Me, I'd break the law, probably, and submit to whatever punishment the government chose.