A method of repairing diseased or dysfunctional pancreas or liver is provided. The method involves preparation of a suspension of stem cells and/or progenitor cells such as biliary tree stem cells, hepatic stem cells, pancreatic stem cells or their descendants, committed progenitor cells, from healthy tissue of the patient or of the biliary tree of a non-autologous donor and engrafting the cells into the wall of bile ducts near to the organ to be treated. The graft consists of stem cells or progenitors that are admixed with biomaterials and, optionally, with cytokines and/or native epithelial-mesenchymal cells appropriate for the maturational lineage stage of the cells to be engrafted. The cells are specifically introduced to the hepato-pancreatic common duct of the subject for treatment of pancreatic conditions or to the bile duct wall near to the liver for treatment of liver conditions and allowed to migrate to the pancreas or to the liver and expand and then rebuild part or the entirety of the diseased or dysfunctional organ.