Complex sentence: It was mounted on the military space station ALMAZ/Salyut 3/OPS-2 as selfdefence weapon and at the end of the mission, when the station flew unmanned mode, was tested and successfully fired.
Split into simpler sentences: It was mounted on the military space station ALMAZ/Salyut 3/OPS-2 as self-defence weapon. At the end of the mission, when the station flew unmanned, it was tested and successfully fired.