The principal biblical references to Mary's sorrows are in Luke 2:35 and John 19:26-27. The Lucan passage is Simeon's prediction about a sword piercing Mary's soul; the Johannine passage relates Jesus' words to Mary and to the beloved disciple.
Many early Church writers interpret the sword as Mary's sorrows, especially as she saw Jesus die on the cross. Thus, the two passages are brought together as prediction and fulfillment.
St. Ambrose in particular sees Mary as a sorrowful yet powerful figure at the cross. Mary stood fearlessly at the cross while others fled. Mary looked on her Son's wounds with pity, but saw in them the salvation of the world. As Jesus hung on the cross, Mary did not fear to be killed but offered herself to her persecutors.