It was a justifable action; to prevent further harm to others, the only way he could end that would be to kill Fajo, or himself.
He could have ended it without killing anybody. He could have surrended his freedom and obeyed Fajo - if not forever, then for long enough to find an alternative.
By choosing to kill Fajo, Data was placing his own freedom above somebody's life.
Fajo had murdered, but one murder doesn't excuse another.
This has always bothered me.