“由于”is used in the sentense which is made up of a cause and a effect. “由于”is always used before the cause.
Furthermore, "由于" and the cause always appear in the fore part of the sentence. Generally speaking, "由于" is always used in written language. In spoken language, we always use "因为" on the same condition.
由于缺乏证据,被告被释放了。