The 80-year-old man only realised he had not collected his grandson when the police arrived at his house.
A Polish grandfather accidentally collected the wrong boy from a nursery school, prompting a police operation.
The 80-year-old man only realised he had not picked up his grandson when police arrived at his house, the authorities say.
The four-year-old boy was quickly and safely returned to his parents in Lubartow, police added.
"There was a mistake and fortunately the whole situation ended well," the region's police said in a statement.
Officers first received reports of a missing child on Friday, who had disappeared from one of Lubartow's kindergartens.
Police patrols, including a dog handler, were quickly mobilised across the city to find the four-year-old.
An employee of the nursery school had notified the authorities that they had seen the child leaving with an elderly man.
Police were able to find the boy after one of the addresses where they believed he could be staying.
"As they found out, there had been a mistake, the grandfather of another boy came to the kindergarten and picked up the wrong grandchild," Lubartow police stated.
"It was all due to the similarity of both boys' names and an unexpected coincidence.
"It was only during the police officers' visit that the 80-year-old realised that the child who was watching cartoons at his flat was not his grandson."
Police say they are still investigating whether there was any danger to the boy's health, but have not charged anyone with any offense.