BUDAPEST, Hungary >> After a rocket attack in eastern Ukraine, half of Rambo’s face was mangled and bloody. Shrapnel had ravaged the right side of his head, and it was uncertain if he would survive.

The 3-year-old German shepherd, who had accompanied Ukrainian soldiers on the front lines of the war, received emergency surgery that saved his life. Now, Rambo is training with the Budapest police department in neighboring Hungary and serving as a reminder that dogs — and people — with disabilities can do great things.

Recovered from his brush with death in northeastern Ukraine’s Kharkiv province, Rambo is learning how to interact with children, older adults and disabled people at police demonstrations and rehabilitation institutions, according to Lt. Col. Maria Stein with the Budapest Metropolitan Police.

Demonstrating the tasks performed by canine units is part of the department’s crime prevention program, with a goal of teaching young people to be more tolerant and to respect one another’s differences, Stein said.

“Nowadays, unfortunately, it happens that children mock each other because they wear glasses, because they have braces, because their ears look funny or whatever — because they’re different,” she said. “With Rambo, we might be able to sensitize these children a little and show them that yes, he is injured, he’s different, but he can do the same things as other dogs.”

Rambo’s journey to police service didn’t come easy. Last year, shrapnel from the rocket attack, which also injured some Ukrainian soldiers, blew away pieces of skull, damaging his jaw and severely mangling his right ear.

After his initial surgery, Rambo was taken to safety in western Ukraine. Violetta Kovacs, head of a Hungarian organization dedicated to rescuing German shepherds, soon collected him and brought him to a rehabilitation center near Budapest.

“The dog needed immediate help,” Kovacs, head of the German Shepherd Breed Rescue Foundation, said. “We had to operate again here in Hungary because several of his teeth were causing him great pain because of the injury, which required immediate intervention.”

Rambo spent eight months at the center, where his jaw was reconstructed, his right ear amputated and several teeth removed. He underwent training to be socialized with other dogs, Kovacs said, but his fondness for children was clear from the start.

Gyula Desko, a lieutenant colonel with the Budapest Metropolitan Police, then adopted Rambo, providing him with further training and a home.

He called Rambo a “very friendly, good-natured dog” who is making good progress in his training and whose survival was “a miracle.”