"We could have avoided" suggests that the action is already done, and out of the way. The could-have-avoiding is over.
Can be avoided meaning?
: to stay away from (someone or something) : to prevent the occurrence of (something bad, unpleasant, etc.) : to keep yourself from doing (something) or participating in (something)
Would have been avoided meaning?
"It could have been avoided" leaves it open to the possibility that either the imprisoners or the prisoner could have avoided it as the event unfolded. "It could have been prevented" seems to me to say that steps could have been taken beforehand to make sure that such an arrest would not happen.