Joe Mauer insists he has not decided whether he will retire. Now he has no choice.

You don’t rewrite the ending to “Casablanca.” You can’t improve on perfection. Sunday afternoon, in what may have been his last game, Mauer and his friends authored the best baseball screenplay since “The Natural,” turning the last three innings of the Twins’ season finale into a one-man, two-act play commemorating one of the great careers in franchise history.

Mauer could come back, could play a role, but he will never play one as poignant as the one he helped write Sunday, when the Twins did everything they could, short of adding curtains, to turn Target Field into a stage.

Before the first pitch of the Twins’ 5-4 victory over the White Sox at Target Field on Sunday, Mauer’s daughters ran to first base, wearing miniature replicas of his jersey. Photographers formed a semicircle around the Minnesota Twin and his Minnesota twins, turning the moment into a poster, or an heirloom.

There was applause, some of it coming from the dugout, where Mauer’s teammates waited, unsure whether they should interrupt. Mauer looked their way, made a face and then a motion for them to take the field. When they hesitated, he twirled his right index finger faster, spurring them onto the diamond. A stoic turned sentimental, Mauer wanted to enjoy the moment, yet didn’t want it to last too long.

Before, during and after what might have been his last game as a Minnesota Twin, Mauer gave similarly conflicting signals. He behaved as if he plans to retire while insisting he has not made a final decision.

He talked at length at his locker before the game, mentioning the many family members who would be in attendance, including those who rarely attended. His manager, Paul Molitor, batted him leadoff, so when Mauer walked toward the plate the crowd would have time to cheer.

Mauer held his helmet aloft, acknowledging the crowd, and the catcher and home plate umpire stood back from the plate while he approached. He shook their hands, then grounded to second.

His four at-bats proved historically accurate. He grounded to second in the first inning, providing a reminder of his most common out. In the third, he hit a grounder up the middle that was foiled by the shortstop’s positioning, a reminder that defensive shifts have cost him perhaps hundreds of base hits. In the fifth, he flew to left-center, a reminder that he owns one of the game’s best inside-out swings.

When Mauer came to bat in the bottom of the seventh, the time for quaint remembrances was over. Mauer was about to remind us who he was, at his best.

He worked the count full, then lined a shot deep to left-center, the Mauer Alley, and beat the throw to second by the length of a cleat, slapping his hands as he popped to his feet. A few Twins employees had hoped before the game that Mauer would hit a home run in his last at-bat, but his signature hit was always the opposite-field double, and his final at-bat would prove as symbolically fitting as was the milestone of another Cretin-Derham Hall alum.

When Molitor produced his 3,000th hit, it was an opposite-field triple that ended with a belly slide. “Hey,’’ Molitor said later, “we were taught that you’ve always got to run the bases right.’’

Mauer’s career should be broken into three segments. From 2005 through 2010, he was one of the greatest catchers, and maybe the greatest-hitting catcher, ever to play the game. From his mystery-injury season of 2011 through 2013 he remained an All-Star player even as injuries limited him.

From the time he caught his last game, in August 2013, through Sunday, Mauer became a light-hitting first baseman whose skills — taking quality at-bats and fielding the position well — did not measure up to the largest contract in franchise history.

Sunday, Mauer’s allies didn’t stop at showing videos of his prime. They took us back in time.

His father had wondered about Mauer catching one more time, and his wife had agreed, as long as he didn’t have to take a foul ball and risk triggering the concussion symptoms that have plagued him.

Molitor, Twins equipment manager Rod McCormick, traveling secretary Mike Herman and bullpen catcher Nate Dammann, among others, worked on a plan to allow Mauer to catch. Just one pitch.

Molitor asked White Sox manager Rick Renteria if he would have the first hitter in the top of the ninth take one pitch. Molitor promised it would be a ball.

Max Kepler made the last out in the bottom of the eighth and began jogging toward right field. His teammates called him back. After a long pause, Mauer emerged from the dugout, the only player on the field, and held his helmet aloft and patted his chest while the crowd stood and cheered.

Mauer caught one pitch, walked to the mound to embrace Belisle, and headed to the dugout.

He had kept his old equipment bag around the house, while he pondered framing his gear. McCormick told him that his kids had taken Mauer’s old, white-framed helmet home and played with it, scarring the paint. “I told him it might have some mold and mildew, but it wasn’t too bad,’’ McCormick said with a smile.

Mauer wore the tools of reminiscence one more time. “I don’t know who wrote up this day,’’ he said. “Actually I know who wrote up the day. But I’m just very thankful for it.’’

Mauer conducted a news conference after the game, which was shown, tape-delayed, in the Twins clubhouse. All of the players sat in front of his locker, watching, and when Mauer returned they burst into applause.

Don’t try to top this, Joe. Don’t try to top the perfect ending.