The Algeria international was dropped to the bench for Saturday's 3-0 defeat at Chelsea but he was back in the starting line-up on Tuesday night and scored the only goal in the 1-0 Champions League win over Copenhagen.
Ranieri believes his goal and performance justified his decision to leave him out against the Blues.
He said: "For this reason I put him on the bench against Chelsea. Now it's right."
Ranieri also praised Kasper Schmeichel after the goalkeeper produced a wonderful one-handed stop in the 89th minute to deny Andreas Cornelius an equaliser for the Danish side.
The Italian coach added: "Thank you to Kasper, thank you to all my players. Because in every high ball, Copenhagen are very, very strong. Now I'm already thinking about what happens when we go to Copenhagen."