Sheriffs escorted the girl's parents, who can't be named under child protection laws, in handcuffs into the Al Rashid mosque.
People who attended the service say the mother was almost overcome with emotion as she prayed beside the small pink coffin in a room for women, while the father was in tears when the coffin was brought into a room for men.
The girl, known in court documents as M, spent the last three months in a coma, virtually brain dead.
She died Thursday night shortly after the Supreme Court of Canada rejected a request to stay an Alberta appeal court ruling that allowed doctors to remove her from a ventilator.
The parents face charges of aggravated assault, criminal negligence causing bodily harm and failing to provide the necessities of life — offences that are expected to be upgraded now that the girl is dead.
Mustafa Khattab, the imam of the Al Rashid mosque, said Friday the father and mother are not members of the Al Rashid but the community is supportive of their difficult situation.
A judge granted an order on Friday to allow the couple to be escorted by security officers to the service.
A condition remains in effect that they not have any contact with each other.
The parents had fought to keep the girl on life-support.
Doctors testified that the girl had an irreversible brain injury and would never regain consciousness.
Paramedics called to their home on May 25 found the girl and her twin sister suffering from injuries and severe malnourishment. Police said they weighed just 13 and 16 pounds.
The surviving girl is now in foster care, as is an older brother, who had also been living in the home but wasn't injured.
Also on HuffPost