Phytase is used as a feed additive for degradation of antinutritional phytate, and the enzyme is desired to be highly thermostable for it to withstand feed formulation conditions. A Bacillus sp. MD2 showing phytase activity was isolated, and the phytase encoding gene was cloned and expressed in Escherichia coli. The recombinant phytase exhibited high stability at temperatures up to 100 degrees C. A higher enzyme activity was obtained when the gene expression was done in the presence of calcium chloride. Production of the enzyme by batch- and fed-batch cultivation in a bioreactor was studied. In batch cultivation, maintaining dissolved oxygen at 20-30% saturation and depleting inorganic phosphate below 1 mM prior to induction by IPTG resulted in over 10 U/ml phytase activity. For fed-batch cultivation, glucose concentration was maintained at 2-3 g/l, and the phytase expression was increased to 327 U/ml. Induction using lactose during fed-batch cultivation showed a lag phase of 4 h prior to an increase in the phytase activity to 71 U/ml during the same period as IPTG-induced production. Up to 90% of the total amount of expressed phytase leaked out from the E. coli cells in both IPTG- and lactose-induced fed-batch cultivations.