Phragmatopoma californica is a marine polychaete that builds protective tubes by joining bits of shell and sand grains with a secreted proteinaceous cement. The cement forms a solid foam (closed cells) via covalent crosslinking, as revealed by electron and laser scanning confocal microscopy. The cement contains extractable calcium and magnesium, and non-extractable phosphorus. Amino acid analysis demonstrated that the phosphorus is in the form of phosphoserine and that >90% of serine in the cement (i.e. 28 mol% of residues) is phosphorylated. In addition to previously identified basic proteins, the cement contains a highly acidic polyphosphoserine protein as a major component. We propose a model for the structure and bonding mechanism of the cement that has the following major features: (1) within the secretory pathway of cement gland cells, the electrostatic association of the oppositely charged proteins and divalent cations (Ca2+ and Mg2+) condense the cement proteins into dehydrated secretory granules; (2) the condensation of the cement leads to the separation of the solution into two aqueous phases (complex coacervation) that creates the closed cell foam structure of the cement; (3) rehydration of the condensed cement granules after deposition onto tube particles contributes to the displacement of water from the mineral substrate to facilitate underwater adhesion; and (4) after secretion, covalent cross-linking through oxidative coupling of DOPA gradually solidifies the continuous phase of the cement to set the porous structure.