One-Eyed Jacks

Rio (Marlon Brando) (also called "The Kid"), his mentor Dad Longworth (Karl Malden), and a third man called Doc rob a bank of two saddlebags of gold in Sonora, Mexico. The robbery is successful, but Mexican Rurales track them and catch them celebrating in a cantina, killing Doc. Dad and Rio manage to escape.
After getting cornered on a high ridge, with Rio's horse dead, Rio figures the Rurales will be "swarming all over us inside an hour." Deciding that one partner might take the remaining pony, ride to a jacalito down the canyon about five miles and return with fresh mounts, they gamble for it, with Rio fixing the deal so his pal Dad can be the one to go.
Dad gets to a corral, strapping the swag bag onto a fresh pony, but he gets second thoughts. He casts one eye towards a point on the ridge sure to be taken by the Rurales, and with the other he gazes off in the opposite direction out past a low-lying treeline towards the border and safety. One way leads to danger and a poor chance at surviving with half the booty, the other towards a virtual certainty with all of it. After a decidedly short moment of reflection, he leaves his friend to be taken by Rurales. Rio is arrested and transported to prison by way of the jacalito, where he learns firsthand of Dad's betrayal from the owner.
Rio spends five hard years in a Sonora prison, giving him ample time to mull over Dad's betrayal before escaping with new partner Chico Modesto (Larry Duran) and going hunting for him. When he locates him, Longworth has used his wealth to become the sheriff of Monterey, California. Instead of ambushing Dad, Rio gives him a chance to explain why he left him back in Mexico, pretending he had never been captured to put him off-guard. Longworth's awkward self-serving story is easily seen through.
All along Rio planned not only to kill Dad, but to pull off a bank robbery in Monterey with his new partners Chico and "scum-suckin' pig" Bob Emory (Ben Johnson) (who used his knowledge of Dad's whereabouts to force their partnership). Plans are sidetracked when Rio falls in love with Longworth's beautiful virginal stepdaughter Louisa (Pina Pellicer), taking advantage of a fiesta to spend the night with her on the beach. Dad tries to make Louisa confess to being deflowered, but after intervention by his wife Maria (Katy Jurado) he backs down. He nevertheless traps Rio and administers a vicious beating with a whip in front of the entire town, smashing Rio's gun hand with the butt of a shotgun in an attempt to end his gun-slinging days.
While recovering from his wounds near the ocean, Rio struggles with his conflicting desires to love the girl and to kill her stepfather. He decides to forgo vengeance, fetch Louisa and leave, but Emory, having decided that Rio will never be fast enough to challenge him again, kills Chico and pulls off the bank job without Rio's knowledge. The heist goes wrong and a young girl is killed. Rio is falsely accused and locked up by Longworth. Knowing that the trial's outcome is certain, Rio sure to be hanged in two days, Dad has one last private talk with him, again attempting to absolve himself, to which Rio replies, "You may be a one-eyed jack around here, but Iâve seen the other side of your face." Rio confesses to being imprisoned for the last five years, but Dad calls it a lie.
After Louisa visits Rio in jail to confess that she is going to have his baby, he is beaten by sadistic deputy Lon Dedrick (Slim Pickens) out of envy for Louisa's affection. Maria faces Dad about telling her the truth, stating she knew something was wrong since the moment Rio arrived and that Dad is going to hang him out of pure guilt. Longworth angrily leaves.
Louisa attempts to smuggle a Derringer pocket pistol to Rio, but she is discovered by Lon, who leaves the gun on a table. While they are out, Rio with great difficulty is able to get hold of the pistol, but it is without ammunition. Rio bluffs his way out of jail, helping himself to Lon's revolver after a tense confrontation. As he is making his escape, he is spotted by Dad in the center of town. Under fire and left with no choice, Rio kills Longworth in a final showdown.
Rio and Louisa ride out to the dunes and say a sentimental farewell. Rio will now be a hunted man and is already wanted in Mexico, so he tells Louisa that he's going to Oregon, but to look for him in the spring, when he will return for her.

Question: Where did Rio spend time in prison?
Answer: Sonora.; Sonora.