There's definitely a part of the message that West Side Story conveys that indicates the deleterious consequences of racial/ethnic prejudice and gang violence and what it can and often does lead to, and is not a good way to go. Yet, at the same time, when such circumstances arise, there's bound to be retaliation, even on the part of somebody who probably really doesn't wish to retaliate, but in the end, feels that there's no choice. Tony, I think, is the perfect example of that...the rough/tough-but-tender individual who reveals his tenderness when he falls in love with Maria, and yet re-reveals his old "street" self when Riff, who is very much like a brother to Tony, is stabbed to death by Bernardo....
The old "street" Tony, with his old street reflexes and responses still intact, reveals a part of his personality that was still there (despite his love for Maria) as he stabs and kills Bernardo in retaliation. He tried not retaliating when Bernardo began roughing up and insulting Tony, but that clearly didn't work. Tony's anger and frustrations came out when Riff was killed, but more importantly, it proved that Tony was still a streetwise kid with the fighting instinct in him. Because instincts like that can be virtually, if not absolutely impossible for a kid of Tony's familial and environmental upbringing to suppress, his retaliation against Bernardo was a long time coming, due to Riff and Tony's very close friendship, but the Jets, as a group/gang overall, were still Tony's friends, acquaintances and neighbors.
Some people will claim that Riff ultimately pulled Tony back into the Jets, even though Tony tried his best to repudiate the Jets as a gang overall. Perhaps, though, since Tony clearly could not/would not repudiate Riff as a close friend, he was still a Jet through and through, despite his deep love for Maria. Yet, at the same time, when the Jets and Sharks were calling out/naming weapons for the next night's Rumble at the pre-Rumble War Council in Doc's Candy Store, Tony was the one who suggested that the Jets and Sharks make the Rumble into a "fair" fight, where the best man from each gang would slug it out with fists. The Jets and Sharks finally agreed to that, but Bernardo certainly had difficulty containing his disappointment when Riff picked Ice, instead of Tony, to fight him.
It was hard for Riff to take when Bernardo began roughing up and insulting Tony, who he considered his close friend and like a brother to him, and he understandably came to Tony's defense, especially in the end, when Bernardo insulted Tony once too many times, and hauled off and belted him. Not surprisingly or incidentally, switchblade knives, despite the fact that a "fair fight" between Bernardo and Ice (which had just started to get underway when Tony arrived, at Maria's request, to try to stop the Rumble from occurring at all.), and both stabbings occurred. The fact that the dying Riff hands Tony his switchblade knife just before he fell to the ground after he's been stabbed by Bernardo indicates something; that the retaliatiatory stabbing of Bernardo at the hand of Tony, had been coming and was now at hand.
Yet, at the same time, Tony's death at the hands of Chino by gunshot, was a long time coming, as well, due to jealousies (Chino was the man whom Bernardo had brought his sister, Maria, to the Continental United States to marry.), as well as tribal, cultural and ethnic loyalties and the very strong sense of turf that's always a very common part of gang warfare, as is this type of "brother for brother, blood for blood" retaliation.
Yet, at the same time, a ray of hope seems to come shining through, as Maria brings the Sharks and the Jets to reality as they're about to clash once again after Tony's death with her strong message:
"You all killed him!(meaning Tony)! And my brother and Riff! Not with bullets and guns! With hate! Well, I can kill too, because now I have hate!"
When several Jets and Sharks come together to carry Tony's body off, that seemed to be the first step towards a possible reconciliation, as well as an understanding in tragedy, no matter how brief, or how long.
When one looks at what happens throughout the world, and even here in the United States in real life, when it comes to fighting (i. e. the Middle East and Northern Ireland are two of the most intense examples of the "blood for blood, brother for brother" retaliation, one has to wonder what it will take for those two parts of the world to calm down.