if you are intervening and you capture pirates, is there a path to prosecute them?
What an asinine question. Piracy on the high seas, is deserving of death. No one in their right might could believe otherwise, unless you want the world court and the court of public opinion to prosecute those who were pirated, and let the real pirates go.
There should be IMHO zero tolerance, and no mercy shown to any such activity. Piracy as we know it died in the 19th century.
The rebirth can only be attributed to the rich prize and little risk (apparently) for engaging in the crime. With the right security force, the right weapons, and the mission to let no one escape back to their homeland, and rules of engagement to support the mission It would take less than a year to end the latest version.