MEXICO CITY — His mother was grievously ill, nearing death. So Jesús Vicuña, 17, made a deal with the heavens. In his prayers for her recovery, he vowed to make a certain painful sacrifice in exchange.

Which is how he found himself the other day walking on his knees, under the weight of a heavy backpack, along a crowded sidewalk in Mexico City.

He winced with each step, and every few paces he fell onto his arms with a groan, seeking a moment of relief that never came.

But more than 20 blocks after he began this ordeal — the last stage of a three-day journey — he knee-shuffled the last few yards into the New Basilica of Guadalupe, Mexico’s most important shrine, and collapsed face down on the cool stone floor, gasping for air. Mr. Vicuña had reached his goal.