early 15c. (implied in deteined), "keep back or away, withhold," from Old French detenir "to hold off, keep back" (12c.), from Latin detinere "hold off, keep back," from de "from, away" (see de-) + tenere "to hold" (from PIE root *ten- "to stretch").
Legal sense of "to hold in custody" is from late 15c. (late 13c. in Anglo-French). Meaning "keep or restrain from proceeding" is from 1590s. Modern spelling is 17c., from influence of contain, retain, etc. Related: Detained; detaining.
-ment
common suffix of Latin origin forming nouns, originally from French and representing Latin -mentum, which was added to verb stems to make nouns indicating the result or product of the action of the verb or the means or instrument of the action. In Vulgar Latin and Old French it came to be used as a formative in nouns of action. French inserts an -e- between the verbal root and the suffix (as in commenc-e-ment from commenc-er; with verbs in ir, -i- is inserted instead (as in sent-i-ment from sentir).
Used with English verb stems from 16c. (for example amazement, betterment, merriment, the last of which also illustrates the habit of turning -y to -i- before this suffix).
The stems to which -ment is normally appended are those of verbs; freaks like oddment & funniment should not be made a precedent of; they are themselves due to misconception of merriment, which is not from the adjective, but from an obsolete verb merry to rejoice. [Fowler]