A judge ordered Pepo to be held in custody until he told police who was his real owner, reports UOL.
Two neighbours, Jorge Machado and R Vega, were disputing ownership of the bird.
Judge Osvaldo Carlos decided the parrot should be sent to prison until he said the name of his owner.
After five days, Pepo said Jorge's name and also sung the anthem of his favourite football team San Lorenzo.
Mr Machado said: "I knew he wasn't going to let me down, he is a real friend and we support the same football team."