Per the dev installed rule (which encourages people to grief), you are allowed to shoot them... you just can't sink them. So demasting them like you did is perfectly fine. But as I said, this rule is a HUGE grief problem. People can ram you and break your boarding and sink a ship you're boarding... and there's nothing you can do about it for fear of being banned for "green on green". That's absurd. The rule needs to state that you can NOT grief another player and if you do, you're fair game. Plain and simple. If they attack your prize that you lay claim to, you should get it.
A simple fix would be to have a "lay claim" button at the start... whoever clicks on it first gets it. Or, a loot roll function at the end that rolls for the cargo and ship (separate from one another).